Hi,
Recorded audio with unity3d microphone API in android have low quality.i made a microphone plugin in java for unity android and recorded an audio but have very good quality.
What is the problem?
java code plugin:
public static void StartRecording()
{
FreeRecorder();
File sampleDir = Environment.getExternalStorageDirectory();
try
{
audiofile = File.createTempFile("sound", ".wav", sampleDir);
}
catch (IOException e)
{
Log.e(TAG_Recorde, "sdcard access error");
return;
}
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_WB);
mRecorder.setOutputFile(audiofile.getAbsolutePath());
mRecorder.setOnErrorListener(errorListener);
mRecorder.setOnInfoListener(infoListener);
try
{
mRecorder.prepare();
mRecorder.start();
}
catch (IllegalStateException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
Log.d(TAG_Recorde , "Start Recording!");
}
Unity code:
private void StartMic()
{
clip = Microphone.Start(Mics[0], true, 15, 24000);
}
Thanks.