Some times I get an invalid state warning after an activity resume, is there a way to check or reset the state of the mic?
What you need to do now, is to decide what level your trigger should be at, then write the logic that says stop monitoring and start recording to a file when that level is exceeded while keeping an eye on he level, once it falls Stop recording to a file and start monitoring.
The main problem I can see is that is that sound is a moving thing, so unless your monitoring for something that you know will be loud and continuous, you're likely to get lots of stops and starts even if the overall level seems quite loud to the ear.
You may want to consider recording for a set time and then check again if you need to keep recording, but you still may hit a trough and start again immediately.
You will only get the best set up once you've tried it.
How on earth does one get the AudioRecorder library to write to an MP3 file - as in, the way it was described when it was posted by its author?
I know it's and old thread but I get Java Null Pointer Exception on Line 47Without knowing the unit of AudioMaxAmplitude it is indeed awkward to produce something like a VU-Meter or a noise level meter. The Android microphone circuit may also include an AGC.
The attached skeleton app is an analog VU-Meter that requires calibration. Perhaps someone has a professional measuring instrument which could be used to calibrate the values and bring it on a logarithmic analog scale.
Ar.AudioSource = Ar.AS_MIC
Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Level") cn.Initialize(Panel1) 'Calls sub AmplitudeCheck every 500 milliseconds T.Initialize("AmplitudeCheck",100) 'Set up recorder A.AudioSource=A.AS_MIC ...
Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Level") cn.Initialize(Panel1) 'Calls sub AmplitudeCheck every 500 milliseconds T.Initialize("AmplitudeCheck",100) 'Set up recorder A.Initialize A.AudioSource=A.AS_MIC ...