SpeechAudioFormatInfo Constructeurs

Définition

Initialise une nouvelle instance de la classe SpeechAudioFormatInfo.

Surcharges

Nom Description
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Initialise une nouvelle instance de la SpeechAudioFormatInfo classe et spécifie les exemples par seconde, les bits par échantillon et le nombre de canaux.

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

Initialise une nouvelle instance de la SpeechAudioFormatInfo classe et spécifie le format d’encodage, les exemples par seconde, les bits par échantillon, le nombre de canaux, les octets moyens par seconde, la valeur d’alignement des blocs et un tableau contenant des données spécifiques au format.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs

Initialise une nouvelle instance de la SpeechAudioFormatInfo classe et spécifie les exemples par seconde, les bits par échantillon et le nombre de canaux.

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)

Paramètres

samplesPerSecond
Int32

Valeur des échantillons par seconde.

bitsPerSample
AudioBitsPerSample

Valeur des bits par échantillon.

channel
AudioChannel

Membre de l’énumération AudioChannel (indiquant Mono ou Stereo).

Exemples

L’exemple suivant montre une utilisation classique de SpeechAudioFormatInfo spécifier le format audio à générer dans un fichier WAV. L’instance SpeechAudioFormatInfo est un argument de la SetOutputToWaveFile méthode.

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

S’applique à

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

Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs
Source:
SpeechAudioFormatInfo.cs

Initialise une nouvelle instance de la SpeechAudioFormatInfo classe et spécifie le format d’encodage, les exemples par seconde, les bits par échantillon, le nombre de canaux, les octets moyens par seconde, la valeur d’alignement des blocs et un tableau contenant des données spécifiques au format.

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

Paramètres

encodingFormat
EncodingFormat

Format d’encodage.

samplesPerSecond
Int32

Valeur des échantillons par seconde.

bitsPerSample
Int32

Valeur des bits par échantillon.

channelCount
Int32

Valeur du nombre de canaux.

averageBytesPerSecond
Int32

Valeur des octets moyens par seconde.

blockAlign
Int32

Valeur de BlockAlign.

formatSpecificData
Byte[]

Tableau d’octets contenant les données spécifiques au format.

S’applique à