Discussion:
Need help with SAPI 5: how to redirect audio to the port?
(too old to reply)
fred
2009-06-09 21:13:59 UTC
Permalink
Hi,
All my hopes are with this group :)
microsoft.public.win32.programmer.mmedia looks like it is on the death bed.
and google search is not the help either.
SAPI SDK is not to clear on this subject I need your help with.
I am using text-to-speech (SAPI5) in my app.
From SAPI 5 SDK:
==================
Set up SAPI audio input/output
To transmit voice data over telecommunications devices using SAPI, it is
very important to set up the audio input and output to the specific audio
device correctly. The following are examples of how to set the audio output
and input in C++ and Visual Basic, respectively.

To set the audio output object for TTS in C/C++, use the following steps:

Create an ISpeechMMSysAudio audio object.
Retrieve the wav/out device identifier and set it to the audio object
calling ISpMMSysAudio::SetDeviceId().
Find the wav format that your audio device supports and assign it to the
audio object using ISpMMSysAudio::SetFormat().
Call ISpVoice::SetOutput () to inform the TTS engine of the audio object.
==================

As far as I understand that, it means that TTS output must be the wav/out
device.
I need to redirect TTS output to the port (to create a TCIP server).

Another quote from SAPI 5 SDK:
=======================
Audio input/output devices
If your audio input or output source is not a standard windows Multimedia
device, you need to create an audio object first and then call SAPI SetInput
and SetOutput to the device (see the Set Audio Input and Output to an Audio
section of this paper). Your application will not work if you simply select
your wave In/Out device as the default audio input or output device using
Speech properties in Control Panel.

=======================

How to approach that problem?
How to create an audio object knowing the TCIP port?

Your comments are appreciated,
Fred
William DePalo [MVP VC++]
2009-06-10 18:25:30 UTC
Permalink
Post by fred
All my hopes are with this group :)
microsoft.public.win32.programmer.mmedia looks like it is on the death bed.
It is.
Post by fred
and google search is not the help either.
Sadly, few of us do speech at the level of SAPI.
Post by fred
Create an ISpeechMMSysAudio audio object.
Retrieve the wav/out device identifier and set it to the audio object
calling ISpMMSysAudio::SetDeviceId().
Find the wav format that your audio device supports and assign it to the
audio object using ISpMMSysAudio::SetFormat().
Call ISpVoice::SetOutput () to inform the TTS engine of the audio object.
==================
As far as I understand that, it means that TTS output must be the wav/out
device.
Well, no. SAPI is built on COM and COM models its output using streams (see
the IStream interface).

The ISPVoice interface has a SetOutput() method which is used to inform SAPI
of the target stream.

http://msdn.microsoft.com/en-us/library/ms719788(VS.85).aspx
Post by fred
I need to redirect TTS output to the port (to create a TCIP server).
Then you need to implement a custom stream which takes the digitized audio
and passes it over the network.
Post by fred
=======================
Audio input/output devices
If your audio input or output source is not a standard windows Multimedia
device, you need to create an audio object first and then call SAPI SetInput
and SetOutput to the device (see the Set Audio Input and Output to an Audio
section of this paper). Your application will not work if you simply select
your wave In/Out device as the default audio input or output device using
Speech properties in Control Panel.
=======================
How to approach that problem?
How to create an audio object knowing the TCIP port?
If you are not careful, SAPI will assume that you are doing speech on the
desktop. It will use the ID of whatever device is specified in the Speech
applet of the control panel to create a stream based on ISpMMSysAudio():

http://msdn.microsoft.com/en-us/library/ms717924(VS.85).aspx

Of course, that only works if you are using a waveform device which uses the
standard API. What that paragraph is trying to say is that if you are not
using the default devices (I.e. the ones specified in the control panel)
which are garden variety speakers and microphones then you must set the
target devices yourself.

Regards.
Will
www.ivrforbeginners.com

Continue reading on narkive:
Search results for 'Need help with SAPI 5: how to redirect audio to the port?' (Questions and Answers)
11
replies
Windows Vista?
started 2007-04-27 05:06:58 UTC
software
Loading...