Android Question AudioRecorder - lib - is it works or not ?

renemo

Member
Licensed User
Longtime User
Hi
I use AudioRecorder in the past but from last Android updates i have some fail with this

This sequence:
Ar.Initialize
Ar.AudioSource = Ar.AS_MIC
Ar.OutputFormat = Ar.OF_THREE_GPP
Ar.AudioEncoder = Ar.AE_AMR_NB
Ar.setOutputFile("","/dev/null")
Ar.prepare
Ar.start

ends with error:
java.lang.RuntimeException: start failed.

Any permission are done
So, Is it some additional changes in use of this lib ?
 

stevel05

Expert
Licensed User
Longtime User
Looking at the problem on the internet, it appears that AMR_NB (and WB) is not as widely supported on devices as it used to be. Probably time to update to something better supported. As Erel suggested, Audio streamer may be a better bet.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
If you really need an AMR_WB format, you could record first record in a WAV format, then use FFmpeg to convert to AMR_WB format.
 
Upvote 0

renemo

Member
Licensed User
Longtime User
I need solution similar to SoundMeter - read mic audio volume in real time - AudioRecorder works fine - AudioStreamer is not in real time
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
Have you tried different audio encoder settings?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Are you saying that the data being processed by the below routine of streamer does not contain real-time volume data?

B4X:
Sub streamer_RecordBuffer (Buffer() As Byte)
    RecOutput.WriteBytes(Buffer, 0, Buffer.Length)
End Sub
 
Upvote 0

kimstudio

Active Member
Licensed User
I need solution similar to SoundMeter - read mic audio volume in real time - AudioRecorder works fine - AudioStreamer is not in real time

For this it is better to user AudioRecord made by steve, record raw PCM audio in a buffer and check raw audio data in the buffer instead of in a file. I believe AudioStreamer is the same and convinient as it has a callback event mentioned by JohnC to avoid using the threading lib. If it is not in real-time you need to reduce the buffersize parameter to for example 100ms or smaller.
 
Upvote 0
Top