What parameters for OutputFormat and AudioEncoder do I use to record as MP3?
What parameters for OutputFormat and AudioEncoder do I use to record as MP3?
Sub ActivateMic(Dir As String, Filename As String) As Boolean
A.Initialize
If Not( A.isRecording) Then' a.stop
Try
A.AudioSource=A.AS_MIC 'a.AS_VOICE_RECOGNITION
If Filename.length = 0 Then
Filename = "/dev/null"
A.OutputFormat=A.OF_THREE_GPP
Else
A.AudioChannels=1
'A.AudioEncodingBitRate=64
'A.AudioSamplingRate=44000
A.OutputFormat=A.OF_MPEG_4
End If
A.AudioEncoder=A.AE_AMR_NB
A.setOutputFile(Dir,Filename)
A.prepare
A.Start
'Log("Mic Started")
Catch
'Log("MIC failed to init")
Return False
End Try
End If
Return True
End Sub
This is what I used
...Else
A.AudioChannels=1
'A.AudioEncodingBitRate=64
'A.AudioSamplingRate=44000
A.OutputFormat=A.OF_MPEG_4
End If...
Since B4A doesnt support optional parameters (yet?) you have to pass it empty strings if you're just trying to monitor the peak
Yes, that's for MP3 using this library.
You can change the bitrates, but most cellphones only have 1 mic
Yes, that's for MP3 using this library.
The resulting file is not at all an mp3 file.
It can be played with the android media player, but it is not encoded in the mp3 format.
Try to open the file with standard software like wavelab or winamp: you will get an error message.
Hey Highwinder,
I have updated the library to Version 2.10.
Not many changes has been made, but it should be easier to create the output file. (It does work for me.)
Tomas
You can record in various file formats including wav, mp3,
After 17 months and a whole bunch of unanswered questions regarding mp3 in this thread, wouldn't it be a good idea to update the first post and remove the word "mp3" in the the following sentence? Finally?
I wonder how many people (including me) spent hours to find out: it isn't true.
public void setOutputFormat (int output_format)
Since: API Level 1
Sets the format of the output file produced during recording. Call this after setAudioSource()/setVideoSource() but before prepare().
It is recommended to always use 3GP format when using the H.263 video encoder and AMR audio encoder. Using an MPEG-4 container format may confuse some desktop players.
it's most likely producing uncompressed WAV. Confirmation would be nice.
You can record in various file formats including wav...
According to Stevel05, it's most likely producing uncompressed WAV.