Android Question Record audio from mic

Devv

Active Member
Licensed User
Longtime User
Hi

i was searching for a way to record audio from mic i found this neat library
http://www.b4x.com/android/help/audiorecorder.html

i was able to record successfully using this code

B4X:
rec.Initialize()
rec.AudioSource = rec.AS_MIC
rec.OutputFormat = rec.OF_THREE_GPP
rec.AudioEncoder = rec.AE_AMR_NB
rec.prepare

the problem is that this settings is making a lot of noise and it cant capture audio from far distance (i must hold my phone near to my mouth so the record will be clear)

is their is a specified type or encode/format that could capture audio from more far distance ?
 

stevel05

Expert
Licensed User
Longtime User
The encoder AMR-NB is the worst quality encoder and is limited to 8khz recording.

Try these settings for a reasonable quality recording:

B4X:
    Rec.Initialize
    Rec.AudioSource = Rec.AS_MIC
    Rec.OutputFormat = Rec.OF_THREE_GPP
    Rec.AudioEncoder = Rec.AE_AAC
    Rec.AudioSamplingRate = 44100
    Rec.prepare

Not all devices support all formats, but these are pretty standard settings so should work.

The final quality of the recording will also be dependent on the hardware, and the conditions in the room (background noise etc.)
 
Upvote 0
Top