PhoneGap + Android - Record Audio in .wav format using Media Librart

1,618 views
Skip to first unread message

dhiren patel

unread,
Jul 24, 2012, 4:30:03 AM7/24/12
to phon...@googlegroups.com

I am trying to record audio using PhoneGap on Android. I want to record in .WAV format.

Code: JavaScript

media.startRecord();

I found that this function record audio in .3gp format by default. If I change the source code of PhoneGap to record in different format. (can be in .amr format)

Code: JAVA, File: AudioPlayer.java

this.recorder = new MediaRecorder(); this.recorder.setAudioSource(MediaRecorder.AudioSource.MIC); this.recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT); // THREE_GPP); this.recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT); //AMR_NB);

But I also found that Android do not support to record in .wav format.http://developer.android.com/guide/appendix/media-formats.html

I don't want to use capture.captureAudio function because that launches an external application.

Please suggest me solution.

Simon MacDonald

unread,
Jul 24, 2012, 9:58:54 AM7/24/12
to phon...@googlegroups.com
As you have seen there is no .wav encoder provided by Android. So you
either launch an external application via an Intent to record as .wav
or you have to live with the .3gp format.

Simon Mac Donald
http://hi.im/simonmacdonald
> --
> -- You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>
> To compile in the cloud, check out build.phonegap.com
>
>

dhiren patel

unread,
Jul 25, 2012, 3:07:04 AM7/25/12
to phon...@googlegroups.com

dhiren patel

unread,
Jul 30, 2012, 3:44:42 AM7/30/12
to phon...@googlegroups.com
I found that it's possible to record audio in .wav format. Check this link

As we can modify the source code of PhoneGap as mentioned in the link we will be able to record the audio in .wav format.

I recorded the audio file file using code given, and it's recording in .wav format. 

What you say? Will it work with PhoneGap?
Reply all
Reply to author
Forward
0 new messages