Switching audio formats

Last reviewed: 8/21/2001

HOW Article ID: H080106

The information in this article applies to:

  • SpeechKit 3


SpeechKit 3 provides you an easy way to switch the audio formats when you need to. For example, if you are generating wave files for playback through telephony systems or other channels that require a different format than the default audio destination multimedia device, then all you have to do is set the AudioFormat property to one of the AudioFormats enumeration values. For example, setting the audio format to 8 kHz 8 bit mono would look something like:

ChantTTS.AudioFormat = AF8kHz8BitMono;

More Information

SpeechKit 3 SR-2 added support for additional audio formats that SAPI5 can convert if the applicable codecs are present on the system. The new formats found in the AudioFormats enumeration are as follows:

  • AFTrueSpeech8kHz1BitMono
  • AFCCITTALaw8kHzMono
  • AFCCITTALaw8kHzStereo
  • AFCCITTALaw11kHzMono
  • AFCCITTALaw11kHzStereo
  • AFCCITTALaw22kHzMono
  • AFCCITTALaw22kHzStereo
  • AFCCITTALaw44kHzMono
  • AFCCITTALaw44kHzStereo
  • AFCCITTuLaw8kHzMono
  • AFCCITTuLaw8kHzStereo
  • AFCCITTuLaw11kHzMono
  • AFCCITTuLaw11kHzStereo
  • AFCCITTuLaw22kHzMono
  • AFCCITTuLaw22kHzStereo
  • AFCCITTuLaw44kHzMono
  • AFCCITTuLaw44kHzStereo
  • AFADPCM8kHzMono
  • AFADPCM8kHzStereo
  • AFADPCM11kHzMono
  • AFADPCM11kHzStereo
  • AFADPCM22kHzMono
  • AFADPCM22kHzStereo
  • AFADPCM44kHzMono
  • AFADPCM44kHzStereo
  • AFGSM6108kHzMono
  • AFGSM61011kHzMono
  • AFGSM61022kHzMono
  • AFGSM61044kHzMono

For speech synthesis, if the audio destination multimedia device does not handle the requested format, the format is not changed and reverts back to the original setting. If the format is support by the device, but engine cannot generate the desired format, a return code is returned on subsequent Play method invocations.

For speech recognition, when recognizing from audio data, you only need to set the ChantSR AudioFormat property prior to invoking the Record method if you are passing audio data in a buffers or via an IStream. If passing the data via an audio file, the the recognzier obtains the format directly from the file.