-1

I want to turn on the MIC when app is run and store this sound temporary and after that send me the sound level in dp.is it possible to create this app.plese help me

thank you

  • possible duplicate of [Get Microphone volume](http://stackoverflow.com/questions/3928202/get-microphone-volume) – Brad Larson Oct 18 '11 at 16:05
  • See also [Getting decibel from an android microphone](http://stackoverflow.com/questions/4271989/getting-decibel-from-an-android-microphone) – Brad Larson Oct 18 '11 at 16:06

1 Answers1

1

Please visit the following Recording tutorial

This part in particular:

String state = android.os.Environment.getExternalStorageState();
if(!state.equals(android.os.Environment.MEDIA_MOUNTED))  {
    throw new IOException("SD Card is not mounted.  It is " + state + ".");
}

// make sure the directory we plan to store the recording in exists
File directory = new File(path).getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
  throw new IOException("Path to file could not be created.");
}

recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();

Furthermore it is not strictly necessery to record a file to run an sound level check, as stated here

Community
  • 1
  • 1
Wojciech Owczarczyk
  • 5,595
  • 2
  • 33
  • 55