SpeechAudioFormatInfo Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the SpeechAudioFormatInfo class.
Overloads
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel) |
Initializes a new instance of the SpeechAudioFormatInfo class and specifies the samples per second, bits per sample, and the number of channels. |
SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[]) |
Initializes a new instance of the SpeechAudioFormatInfo class and specifies the encoding format, samples per second, bits per sample, number of channels, average bytes per second, block alignment value, and an array containing format-specific data. |
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
Initializes a new instance of the SpeechAudioFormatInfo class and specifies the samples per second, bits per sample, and the number of channels.
public:
SpeechAudioFormatInfo(int samplesPerSecond, System::Speech::AudioFormat::AudioBitsPerSample bitsPerSample, System::Speech::AudioFormat::AudioChannel channel);
public SpeechAudioFormatInfo (int samplesPerSecond, System.Speech.AudioFormat.AudioBitsPerSample bitsPerSample, System.Speech.AudioFormat.AudioChannel channel);
new System.Speech.AudioFormat.SpeechAudioFormatInfo : int * System.Speech.AudioFormat.AudioBitsPerSample * System.Speech.AudioFormat.AudioChannel -> System.Speech.AudioFormat.SpeechAudioFormatInfo
Public Sub New (samplesPerSecond As Integer, bitsPerSample As AudioBitsPerSample, channel As AudioChannel)
Parameters
- samplesPerSecond
- Int32
The value for the samples per second.
- bitsPerSample
- AudioBitsPerSample
The value for the bits per sample.
- channel
- AudioChannel
A member of the AudioChannel enumeration (indicating Mono
or Stereo
).
Examples
The following example shows a typical use of SpeechAudioFormatInfo to specify the format of audio to output to a WAV file. The SpeechAudioFormatInfo instance is an argument to the SetOutputToWaveFile method.
using System;
using System.IO;
using System.Speech.Synthesis;
using System.Speech.AudioFormat;
namespace SampleSynthesis
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the SpeechSynthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the audio output.
synth.SetOutputToWaveFile(@"C:\temp\test.wav",
new SpeechAudioFormatInfo(32000, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
// Create a SoundPlayer instance to play output audio file.
System.Media.SoundPlayer m_SoundPlayer =
new System.Media.SoundPlayer(@"C:\temp\test.wav");
// Build a prompt.
PromptBuilder builder = new PromptBuilder();
builder.AppendText("This is sample output to a WAVE file.");
// Speak the prompt.
synth.Speak(builder);
m_SoundPlayer.Play();
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
}
Applies to
SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[])
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
Initializes a new instance of the SpeechAudioFormatInfo class and specifies the encoding format, samples per second, bits per sample, number of channels, average bytes per second, block alignment value, and an array containing format-specific data.
public:
SpeechAudioFormatInfo(System::Speech::AudioFormat::EncodingFormat encodingFormat, int samplesPerSecond, int bitsPerSample, int channelCount, int averageBytesPerSecond, int blockAlign, cli::array <System::Byte> ^ formatSpecificData);
public SpeechAudioFormatInfo (System.Speech.AudioFormat.EncodingFormat encodingFormat, int samplesPerSecond, int bitsPerSample, int channelCount, int averageBytesPerSecond, int blockAlign, byte[] formatSpecificData);
new System.Speech.AudioFormat.SpeechAudioFormatInfo : System.Speech.AudioFormat.EncodingFormat * int * int * int * int * int * byte[] -> System.Speech.AudioFormat.SpeechAudioFormatInfo
Public Sub New (encodingFormat As EncodingFormat, samplesPerSecond As Integer, bitsPerSample As Integer, channelCount As Integer, averageBytesPerSecond As Integer, blockAlign As Integer, formatSpecificData As Byte())
Parameters
- encodingFormat
- EncodingFormat
The encoding format.
- samplesPerSecond
- Int32
The value for the samples per second.
- bitsPerSample
- Int32
The value for the bits per sample.
- channelCount
- Int32
The value for the channel count.
- averageBytesPerSecond
- Int32
The value for the average bytes per second.
- blockAlign
- Int32
The value for the BlockAlign.
- formatSpecificData
- Byte[]
A byte array containing the format-specific data.