SpeechAudioFormatInfo Konstruktoren

Definition

Initialisiert eine neue Instanz der SpeechAudioFormatInfo-Klasse.

Überlädt

Name Beschreibung
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Initialisiert eine neue Instanz der SpeechAudioFormatInfo Klasse und gibt die Beispiele pro Sekunde, Bits pro Beispiel und die Anzahl der Kanäle 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, Anzahl von Kanälen, durchschnittliche Bytes pro Sekunde, Blockausrichtungswert und ein Array an, das formatspezifische Daten enthält.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Quelle:
SpeechAudioFormatInfo.cs
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 der Kanäle 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 Stichproben pro Sekunde.

bitsPerSample
AudioBitsPerSample

Der Wert für die Bits pro Beispiel.

channel
AudioChannel

Ein Element der AudioChannel Aufzählung (angibt Mono oder Stereo).

Beispiele

Das folgende Beispiel zeigt eine typische Verwendung, SpeechAudioFormatInfo um das Format von Audio anzugeben, 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
Quelle:
SpeechAudioFormatInfo.cs

Initialisiert eine neue Instanz der SpeechAudioFormatInfo Klasse und gibt das Codierungsformat, Beispiele pro Sekunde, Bits pro Beispiel, Anzahl von Kanälen, durchschnittliche Bytes pro Sekunde, Blockausrichtungswert und ein Array an, das formatspezifische Daten enthält.

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);
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 Stichproben pro Sekunde.

bitsPerSample
Int32

Der Wert für die Bits pro Beispiel.

channelCount
Int32

Der Wert für die Kanalanzahl.

averageBytesPerSecond
Int32

Der Wert für die durchschnittliche Byte pro Sekunde.

blockAlign
Int32

Der Wert für "BlockAlign".

formatSpecificData
Byte[]

Ein Bytearray, das die formatspezifischen Daten enthält.

Gilt für: