Author |
|
ajdiaz Junior
Joined: December 10 2007 Location: United States Posts: 76
|
Posted: January 16 2008 at 10:08pm | IP Logged
|
|
|
I need to play many wave files back-to-back. For example I need my app to play a sequence of numbers "165323423" and I have 10 wave files, one for each number. Currently the voice output is unpredictable. It cuts off numbers randomly. It also happens in longer wave files played back to back. What is the best way to play many wave files back to back? The .NET sample code has a method called StreamDataToPhoneLine(string filename) and so far that is the only way I know how to do it. Could it be possible to pre-load all my wave files into memory and stream that, instead of having to read from disk every time? If so, how would I go about doing this?
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: January 17 2008 at 11:14am | IP Logged
|
|
|
Hi Alex,
Thanks for posting. Your company has entered into a support agreement with us. As soon as the support agreement gets activated, we can get you example code showing how to do what you want.
You >>>
Currently the voice output is unpredictable. It cuts off numbers randomly.
<<< Support
Hmmm…. Not sure what you mean here. We assume you are sending wave file data to a phone line using a transmit IVR output. Is this correct?
If so, there should be no “cut offs”. The wave file sample block data will be sent out the phone line as it is being sent to the transmit IVR output from your VOIP application. If your transmitted IVR audio is funky or broken up, then something else is going on.
You >>>
What is the best way to play many wave files back to back?
<<< Support
The easiest way is to simply read the raw wave file sample data from the wave files and write appropriate blocks of sample data to the phone line’s tx ivr output. That should be all there is to it. The media engine “read wave file” API procs make this pretty simple.
You >>>
From looking at the StreamDataToPhoneLine(string filename) VB.NET sample procedure…
<<< Support
Yes. That proc in the VB.NET sample code could be modified to do exactly what you want to do.
You >>>
Could it be possible to pre-load all my wave files into memory and stream that, instead of having to read from disk every time? If so, how would I go about doing this?
<<< Support
Yes, Absolutely. The basic algorithm is:
1)
Open a phone line tx ivr outpur channel using the OpenTxIvrChannel() API proc.
2)
Open a wave file using OpenWaveFile() media engine API proc.
3)
Read all raw wave file samples to a temp memory buffer using the GetWaveBuffer() API proc.
4
Copy the temp buffer to the end of your master playback buffer.
5
Close the current wave file using the CloseWaveFile() API proc.
6
Do this for all of your wave files. i.e. Goto back to step 2.
7
Once you have gathered all of your wave file samples, write them to one of the phone line’s tx ivr outputs using the TransmitInCallIvrData() API proc.
8
Wait for all tx ivr data to be played and then close the tx ivr output using the CloseTxIvrChannel() API proc.
The above assumes that you will be reading the sample wave files each time you want to dynamically build and send your data via tx ivr outputs. You could also read each wave file once into individual buffers when your app boots and then all it will have to do is concatenate the appropriate samples from the different buffers into a master playback buffer for playback when you need it.
Support
|
Back to Top |
|
|
ajdiaz Junior
Joined: December 10 2007 Location: United States Posts: 76
|
Posted: February 18 2008 at 10:39am | IP Logged
|
|
|
Hi,
You outline a basic procedure on how to read several wav files into buffer so that I can have them available in memory and whenever I need them I can play them without having to read the wave file again (to basically save Disk IO). I didn't really understand Step 4, "Copy the temp buffer to the end of your master playback buffer" or Step 8, "Wait for all tx ivr data to be played". I do not know how to do that exactly.
Would it be possible to get 2 sample methods (C#)? One to be called at application startup which loads several wave files into global buffer variables. And another to play one of these given buffers. Thanks.
-AJDiaz
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 19 2008 at 7:44am | IP Logged
|
|
|
Hi Alex,
You >>>
Would it be possible to get 2 sample methods (C#)? One to be called at application startup which loads several wave files into global buffer variables. And another to play one of these given buffers.
<<< Support
Yes we will do that. We will try to get it to you yet today. Hang on as we code up the example…
Support
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 20 2008 at 9:15am | IP Logged
|
|
|
Alex,
Still working on the sample code. Will also try to get your v5.12.8.1 media engine update today. Hang on...
Support
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 21 2008 at 11:01am | IP Logged
|
|
|
Alex,
Excuse the delay. We are QAing the media engine release you will be receiving. Your C# .NET sample app code will come with this updated media engine image. We will get this to you today.
Support
|
Back to Top |
|
|
support Administrator
Joined: January 26 2005 Location: United States Posts: 1666
|
Posted: February 21 2008 at 5:03pm | IP Logged
|
|
|
Hi Alex,
Media Engine Update:
See your support FTP account directory “v5.12.8.1 DLL Only”. It contains a timed image of the media engine you should use for development. Download the image. Unzip it and use the new files LMEVoip.lib, LMEVoip.dll, LMEVoipManaged.dll and SipTelephonyApi.h to overwrite your existing files. There is also an updated developer reference you should also use.
We will officially update you before it times out. Read the Engineering notes that come with the distribution for the changes. You will want to run this version of the media engine with your app.
Software examples:
See the following ZIP file in your support FTP account:
Example Source Code\2-21-08\MakeCallStreamMemorySampleData.zip
It contains the latest sample source code you have requested. Also see the file “February Support Log.html” for a history of support hours so far this February.
If this current media engine image looks good, we will cut you an official release any time.
Any questions, please post back to the support forum.
Thanks Alex,
Support
|
Back to Top |
|
|