2. There is no Java Sound API on Android.

1. Use AudioRecord to record the audio to a buffer and calculate the
noise level(incoming decibels to the mic) from the raw PCM data.
Don't forget to bypass the noise cancellation feature, if you need the
surrounding noise.

// Initialise the AudioRecord
AudioRecord record = new AudioRecord(AudioSource.MIC, SAMPLING_RATE,
AudioFormat.CHANNEL_CONFIGURATION_MONO,
AudioFormat.ENCODING_PCM_16BIT, bufferSize);

// Read a sample from MIC
short[] buff = new short[8000];
record.read(buff, 0, buff.length);

On 20 янв, 19:58, manas gajare <[email protected]> wrote:
> 1. I want to trigger a function when the sound level in the surrounding is
> above some threshold level? How can I achieve that?
> 2. Is there any way to implement java sound api in android?
>
> Manas

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to