SpeechAudioFormatInfo 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
初始化 SpeechAudioFormatInfo 类的新实例。
重载
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel) |
初始化 SpeechAudioFormatInfo 类的新实例并指定每秒示例、每个示例的位数和通道的数目。 |
SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[]) |
初始化 SpeechAudioFormatInfo 类的新实例并指定编码格式、每秒的示例、每个示例的位数、通道的数目、每秒平均字节、块对齐值和包含格式特定数据的数组。 |
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
初始化 SpeechAudioFormatInfo 类的新实例并指定每秒示例、每个示例的位数和通道的数目。
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)
参数
- samplesPerSecond
- Int32
每秒示例数的值。
- bitsPerSample
- AudioBitsPerSample
每个示例的位数的值。
- channel
- AudioChannel
枚举的成员 AudioChannel (指示 Mono
或 Stereo
) 。
示例
以下示例演示了 一个典型用法 SpeechAudioFormatInfo ,用于指定要输出到 WAV 文件的音频格式。 实例 SpeechAudioFormatInfo 是 方法的参数 SetOutputToWaveFile 。
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();
}
}
}
适用于
SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[])
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
- Source:
- SpeechAudioFormatInfo.cs
初始化 SpeechAudioFormatInfo 类的新实例并指定编码格式、每秒的示例、每个示例的位数、通道的数目、每秒平均字节、块对齐值和包含格式特定数据的数组。
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())
参数
- encodingFormat
- EncodingFormat
编码格式。
- samplesPerSecond
- Int32
每秒示例数的值。
- bitsPerSample
- Int32
每个示例的位数的值。
- channelCount
- Int32
通道计数的值。
- averageBytesPerSecond
- Int32
每秒平均字节数的值。
- blockAlign
- Int32
BlockAlign 的值。
- formatSpecificData
- Byte[]
包含要特定格式数据的字节数组。