Hello,

I'm using Sipxtapi (main) from .Net (c#) to build an IVR, and found
something I really don't understand.

The .Net IVR uses the Speech API through COM (SAPI 5.1 Interrop dll) to
generate an in memory PCM buffer (8KHz 16 bit) of what's need to be spoken
through the line. Then it uses SipxCallPlayBufferStart() to play the buffer
content and about 50% of the time, I get a very jerky voice (garbled
output).

For other purposes I'm also using SipxCallAudioPlayFileStart() to play WAV
files, and audio quality is near perfect.

Tonight I decided to save the generated PCM buffer to a .WAV file, to help
determine if it's a Speech API or Sipxtapi problem.
  - GeneratePCMBufferFromText()
  - SavePCMBufferToWavFile()
  - SipxCallPlayBufferStart()

--> The saved wav file sound quality is perfect.
--> But Sipxtapi sound output is most of the time jerky. This narrowed down
the problem to sipxtapi.

Then I decided to try with SipxCallAudioPlayFileStart() as the wav file was
on disk.
  - GeneratePCMBufferFromText()
  - SavePCMBufferToWavFile()
  - SipxCallAudioPlayFileStart()

--> Near perfect sound quality.

OK... I start the debugger .. and try to see what's happening withing
sipxtapi. I trace everything down to MprFromFile.cpp and to my surprise the
code handling SipxCallAudioPlayFileStart() and SipxCallPlayBufferStart() is
about the same !!!

Result of SipxCallAudioPlayFileStart() in mprFromFile:
- Load file into buffer
- Stream the buffer

Result of SipxCallPlayBufferStart() in MprFromFile:
- Copy buffer into new buffer
- Stream the new buffer with same code as above !!!

I don't understand what's happening here ... why does the same code can be
jerky when it's called in a different way ?
The only difference I see is:
 SipxCallPlayBufferStart() --> In memory copy of one buffer to another
 SipxCallAudioPlayFileStart() --> Load buffer from file.

In my understanding, a file operation should be slower than an in memory
copy ... but I get garbled audio only in the later case ...

If you have any idea, I would be glad to hear it ... because I'm really
puzzled !

Best regards,

stipus

_______________________________________________
sipxtapi-dev mailing list
[email protected]
List Archive: http://list.sipfoundry.org/archive/sipxtapi-dev/

Reply via email to