Page 1 of 1

invalid wav format in posted audio files

Posted: Thu Jun 22, 2006 9:09 pm
by sweetp123
I am posting my recordings as "audio/x-wav" in my application and saving them as .wav files on the server - they play fine - however when i then try to convert them using an mp3 encoder i always get an error, no matter which encoder i use, particularly with lame
i also get an error when i try to import them into flash or into another application...is there something i am not aware of with respect to these files - should i save them as something else before converting? what is the best way to save them so that i can compress them after? is there a way to compress them when they are posted?

Posted: Thu Jun 22, 2006 9:39 pm
by sweetp123
I've been reading a few posts concerning this and also info in the audio repository manual and it seems as if i should use audio/basic
if i save that as a .wav file will this have the proper format to convert to mp3?

All 3 IVR formats have the same data size, 8KHz 8bit data

Posted: Fri Jun 23, 2006 12:13 am
by support
Hello,

There are formats for audio files recorded by our VoiceXML browser:

Code: Select all

audio/x-wav: wav header + u-law data
audio/basic: headerless u-law data
audio/x-alaw-basic: headerless a-law data
All three of these IVR formats have the same data size, 8KHz 8bit data. So there is no compression gained by switching the format. The audio/x-wav format is the most portable of these because it contains a header describing the data format of the audio.

In order for most desktop software such as flash or lame to use this audio you will need to convert the u-law wav file to a data format that the software understands. You can think of wav as a header that describes the data and u-law as the data itself. Almost all audio tools can read a wav header, but most can not decode u-law data. You will need to convert the audio into linear pcm wav file with a tool like sox:

Code: Select all

sox ulawfile.wav -l -w pcmfile.wav
After you have it in linear pcm wav format you can play it back using flash software or convert it to an mp3 using lame.

Regards,
Plum Support

Posted: Fri Jun 23, 2006 10:33 am
by sweetp123
ok that's fine if i am just converting a few files here and there - what if i want to convert files on the fly in my application and don't have access to a command line (i.e. in coldfusion) then those .wav files are pretty much useless to me. I now need to process one file twice in order to use it? :roll:

do you know if sox has any conversion algorithms written in java or c++ that i can use - or if they have a web service i can access instead of a command line execution?

Posted: Fri Jun 23, 2006 11:02 am
by sweetp123
i just tried this command line with sox and there is no w command
i tried without it and the file size is now huge...?

also lame is not really desktop software - it is an encoding algorithm - so it doesn't actually "use" the file, it just doesn't recognize the format so that it can convert it

Posted: Fri Jun 23, 2006 2:26 pm
by sweetp123
i have managed to convert the file to linear pcm and then to mp3 using lame but the quality is very poor, and if i use a VBR setting which improves the quality, then i have problems again with flash recognizing it
i need to stream the mp3s with flash so they need to be decent quality and proper format
do you have any suggestions on the best command line arguments to use with sox and then the best bit rate and quality settings to use for compressing? i do not work with audio often so your help is really appreciated esp with regards to formats...
should i just record the original message on the vxml platform using audio/basic or stick with the audio/x-wav?

Recording audio for IVR use

Posted: Sat Jun 24, 2006 12:10 am
by support
Hello,

You should be recording the audio in audio/x-wav for the IVR system. This format is exactly the same as audio/basic except that it comes in a file with a header at the beginning saying that it contains u-law data. This helps you by all the necessary information to the audio conversion software about the format of the internal audio.

Have you tried playing the audio back using the linear pcm in flash? This is a decent format for you to push audio around since it very portable and no data loss will occur. If you must convert it to mp3 a good IVR format option is:

Code: Select all

16KHz 16kbps mono:
lame -h test.wav -b 16 --resample 16 -a test.mp3
This IVR format should retain most of the audio data and allow for smaller file sizes (almost 1/3 of the original u-law file). You can also experiment with using a lowpass filter to remove data you don't want being sent anyway (for example: --lowpass 5).

Regards,
Plum Support