Has anybody managed to record a WAV file

mearleybrook

Member
Licensed User
Longtime User
I think I have tried all possible permutations for sound recorder but can not get a wav format output. Anyone done it?
 

mearleybrook

Member
Licensed User
Longtime User
That would be great . I think wav is then best supported uncompressed format to look closely at the signal frequencies. I'll look out for a lucky charm for you!
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
There's a question and info about recording wav files on stack overflow here

It may help you.
 
Upvote 0

mearleybrook

Member
Licensed User
Longtime User
Thanks strevel05 - I am very new to all this and only decided to "have a go" with the advent of B4A. As I read what you tell me it is clear that Java can "get to" the relevant hooks in the operating system to do the job I want. I need B4A to get to them - I did look at trying Java but as a pensioner I fear too many brain cells have died
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
From what I read, if it is in fact accurate, wav's cannot be saved 'natively' and will need some additional conversion.

If you are just planning to work within Android you are probably better sticking to one of the native formats, and only converting when/if you need to export it somewhere else.
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
So in the AudioRecorder library example file,
it's not really recording a wav file?


B4X:
ToastMessageShow("Preparing the AudioRecorder.",False)
AR.AudioSource = AR.AS_MIC
AR.OutputFormat = AR.OF_THREE_GPP  
AR.AudioEncoder = AR.AE_AMR_NB
AR.setOutputFile(File.DirDefaultExternal,"myRecording.wav")
AR.prepare()
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It looks like the three_gpp format is similar to MPeg4. See this wikipedia page.

And this Android developer page states that certain wav files can be decoded but not encoded (along with some more useful info).
 
Last edited:
Upvote 0

stevel05

Expert
Licensed User
Longtime User
You can record a wav file with the AudioRecord Library, see the demo app for the required wav header
 
Upvote 0

mearleybrook

Member
Licensed User
Longtime User
Steve,
Been away for a few days helping out with arrival of 5th grandchild. All fine now and back home. What can I say - thanks you, thank you.
I am modifying your example a little to explore limits of parameters on my phone and create a few files of different sizes to examine more closely. At present I am doing that examination in Excel as it allows for great detail of tracing and debugging - with subsequent quite easy conversion to B4A. My objectives are no more than a ranked measure of the correctness of a pronunciation for a word. More difficult than I had hoped but may still be possible.
Thank you , I am "on my way" again.
 
Upvote 0

bparent

Member
Licensed User
Longtime User
Record to wav file - compatible with other players like Windows Media Player

I plan to try my luck with adding audio / video recording to the Audio library. Hopefully it will solve this issue.

Does your Audio library record to wav file - compatible with other players like Windows Media Player
 
Upvote 0

bparent

Member
Licensed User
Longtime User
3gp file on Windows media player

AudioRecordApp uses the default recording app for the recording. The format is 3gpp. You will need to install a codec in order to play it with Windows Media Player.

Thanks Erel. That's what I discovered also. Windows media by default doesn't play 3gpp files and users have to install a codec to play them. Was hoping there was a conversion or library on Android to save to wav or mp3 files using Audiorecorder or Mediarecorder or something from within B4A.
 
Upvote 0

bparent

Member
Licensed User
Longtime User
Producing wav file with AudoRecord library

You can record a wav file with the AudioRecord Library, see the demo app for the required wav header.

Thanks Steve, that does work. Just make sure to change per the thread note: "For use with V2 of B4a (more specifically the latest threading library) you'll need to add a parameter to the start thread call in artest. Line 89, Record.Start("Recording",Null) becomes Record.Start(Null,"Recording",Null)"

The wav file is fairly large for a short recording. Do you know of a way to compress the wav file or even produce a mp3 file. Again, thanks for your help and fine work.
 
Upvote 0
Top