Share via


SpeechAudioFormatInfo Konstruktoren

Definition

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse.

Überlädt

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse und gibt die Beispiele pro Sekunde, Bits pro Beispiel und die Anzahl von Channels an.

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

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse und gibt das Codierungsformat, Beispiele pro Sekunde, Bits pro Beispiel, Zahl der Channel, durchschnittliche Bytes pro Sekunde, Blocksausrichtungswert und ein Array, das formatspezifische Daten enthält, an.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Quelle:
SpeechAudioFormatInfo.cs
Quelle:
SpeechAudioFormatInfo.cs
Quelle:
SpeechAudioFormatInfo.cs

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse und gibt die Beispiele pro Sekunde, Bits pro Beispiel und die Anzahl von Channels an.

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)

Parameter

samplesPerSecond
Int32

Der Wert für die Beispiele pro Sekunde.

bitsPerSample
AudioBitsPerSample

Der Wert für die Bits pro Beispiel.

channel
AudioChannel

Ein Member der AudioChannel -Enumeration (gibt Mono oder Stereoan).

Beispiele

Das folgende Beispiel zeigt eine typische Verwendung von SpeechAudioFormatInfo zum Angeben des Audioformats, das in eine WAV-Datei ausgegeben werden soll. Die SpeechAudioFormatInfo -Instanz ist ein Argument für die SetOutputToWaveFile -Methode.

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();  
    }  
  }  
}  

Gilt für:

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

Quelle:
SpeechAudioFormatInfo.cs
Quelle:
SpeechAudioFormatInfo.cs
Quelle:
SpeechAudioFormatInfo.cs

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse und gibt das Codierungsformat, Beispiele pro Sekunde, Bits pro Beispiel, Zahl der Channel, durchschnittliche Bytes pro Sekunde, Blocksausrichtungswert und ein Array, das formatspezifische Daten enthält, an.

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())

Parameter

encodingFormat
EncodingFormat

Das Codierungsformat.

samplesPerSecond
Int32

Der Wert für die Beispiele pro Sekunde.

bitsPerSample
Int32

Der Wert für die Bits pro Beispiel.

channelCount
Int32

Der Wert für die Channelanzahl.

averageBytesPerSecond
Int32

Der Wert für die durchschnittliche Anzahl Bytes pro Sekunde.

blockAlign
Int32

Der Wert für den BlockAlign.

formatSpecificData
Byte[]

Ein Bytearray, das die zu formatspezifischen Daten enthält.

Gilt für: