共用方式為


SpeechAudioFormatInfo 建構函式

定義

初始化 SpeechAudioFormatInfo 類別的新執行個體。

多載

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

初始化 SpeechAudioFormatInfo 類別的新執行個體,並指定每秒樣本數、每個樣本的位元數和通道數目。

SpeechAudioFormatInfo(EncodingFormat, Int32, Int32, Int32, Int32, Int32, Byte[])

初始化 SpeechAudioFormatInfo 類別的新執行個體,並指定編碼格式、每秒樣本數、每個樣本的位元數、通道數目、每秒平均位元組數目、區塊的對齊值,以及包含格式特定資料的陣列。

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

來源:
SpeechAudioFormatInfo.cs
來源:
SpeechAudioFormatInfo.cs
來源:
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 (表示 MonoStereo) 。

範例

下列範例示範 的一般用法 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[])

來源:
SpeechAudioFormatInfo.cs
來源:
SpeechAudioFormatInfo.cs
來源:
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[]

包含格式特定資料的位元組陣列。

適用於