Page 1 of 2
save records as wav file
Posted: Tue Aug 24, 2004 2:23 am
by Vlad
I have a problem to save and open recorded messages as a wav file.
When i try to open the saved file i get an error that format is not
correct. I use type='audio/x-wav' in <record> tag and save all
input stream as a wav file.
Code: Select all
<form id='description1'>
<record name='description1' type='audio/x-wav' beep='true'>
<prompt>
Please say description for your answer
</prompt>
<filled>
I heard, <value expr='description1'/>
</filled>
</record>
<block>
<submit next='VxmlSaveAnswers.aspx' namelist='description1' method='post' enctype='multipart/form-data'/>
</block>
</form>
-----------------------------VxmlSaveAnswers.aspx.cs-------------------
StreamReader sr = new StreamReader(Request.InputStream);
string wavFile = sr.ReadToEnd();
byte[] ba = HttpUtility.UrlDecodeToBytes(wavFile);
FileStream fs = new FileStream(filePath, FileMode.CreateNew);
BinaryWriter bw = new BinaryWriter(fs);
bw.Write(ba);
bw.Flush();
fs.Close();
Please elaborate on the IVR error you are encountering.
Posted: Tue Aug 24, 2004 11:14 am
by support
Vlad:
More information is needed. Please elaborate on the IVR error you are encountering. Is it a vxml error that you are pulling from the IVR lastlog field on the hosted IVR site? Is it an IVR error in the asp page?
I'm not an expert on asp, most of our engineers here use php or jsp for serverside processing. It strikes me that you never reference the HTTP POST variable named "description1", unless you neglected to post in that part of your asp page. That's where the audio data is stored.
Post back with more details please.
Plum Support
wav format
Posted: Tue Aug 24, 2004 11:36 am
by Vlad
Thank you for response.
I have succeed to save wav file on the server.
The problem is that i can't to open this file with Media Player.
I checked this file with hex editor and discovered that there are
some information was wroten before the header (before RIFF)
and chunk's size is not correct. After i changed this file in hex editor
i succeed to open it with Media Player.
So the question is i get not correct stream from PLUM or i must to
work with this stream for convert it to wav format?
IVR engineers use a utility called sox for conversions
Posted: Tue Aug 24, 2004 11:53 am
by support
Hi Vlad:
The reason it won't work by default is due to the fact that the audio file returned by the
<record> tag is stored in headerless PCM, you'll have to apply a conversion to this to get into wav format. Our IVR engineers here use a utility called sox to do the conversion. A sample is in order:
Code: Select all
sox -t ul -r 8000 /tmp/input.ul /tmp/ouput.wav
The preceding code takes a raw pcm file uploaded to /tmp, and turns it into an 8khz, 8 bit wav file
If you already have an audio conversion tool you can use that,
or you can use sox for windows:
http://www.spies.com/Sox/
hope this helps!
Plum Support Team
Posted: Tue Aug 24, 2004 12:10 pm
by Vlad
OK.
But if i use record tag with type='x-wav' i get a file with header.
Which type i should use?
IVR issue with ulaw
Posted: Tue Aug 24, 2004 12:37 pm
by support
x-wav is fine for an audio format. You don't have to use sox; the IVR issue is that Windows
media player does not recognize ulaw. If you use a program that recognizes headerless ulaw
properly it will work (like cool edit or a similar program)
the sox command I supplied will make it playable in windows media player
cheers,
support
Posted: Wed Aug 25, 2004 10:50 am
by Vlad
Hi.
sox make my file readable for Media Player but data was
corrupted... may be you now why?
Thank you.
more information needed for IVR concern
Posted: Wed Aug 25, 2004 10:51 am
by support
Vlad:
I don't understand your last IVR post, can you please provide more information?
thanks,
support
Posted: Wed Aug 25, 2004 10:57 am
by Vlad
sox command make my file playable in windows media player
but i don't hear the same information that i saved to file.
IVR issue with hearing recording
Posted: Wed Aug 25, 2004 12:44 pm
by support
If you don't hear what you recorded, then what are you hearing? We need to know to better understand your IVR issue.
Posted: Thu Aug 26, 2004 1:42 am
by Vlad
Only noise.
Posted: Thu Aug 26, 2004 7:21 am
by Vlad
Could you send me a code example how you
save records as a wav file?
IVR code sample in PHP
Posted: Thu Aug 26, 2004 10:02 am
by support
we can post an IVR code sample but it will be in php...is that ok?
Support
Posted: Thu Aug 26, 2004 10:26 am
by Vlad
OK
Thanks.
Posted: Sun Aug 29, 2004 5:04 am
by Vlad
What about code example?