Partager via


SpeechAudioFormatInfo Constructeurs

Définition

Initialise une nouvelle instance de la classe SpeechAudioFormatInfo.

Surcharges

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

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

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

Initialise une nouvelle instance de la classe SpeechAudioFormatInfo et spécifie le format d'encodage, les exemples par seconde, les bits par exemple, le nombre de canaux, les octets moyens par seconde, la valeur d'alignement de bloc et un tableau contenant les 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 classe SpeechAudioFormatInfo et spécifie les exemples par seconde, les bits par exemple 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

La valeur des échantillons par seconde.

bitsPerSample
AudioBitsPerSample

La valeur des bits par échantillon.

channel
AudioChannel

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

Exemples

L’exemple suivant illustre une utilisation classique de SpeechAudioFormatInfo pour spécifier le format de l’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 classe SpeechAudioFormatInfo et spécifie le format d'encodage, les exemples par seconde, les bits par exemple, le nombre de canaux, les octets moyens par seconde, la valeur d'alignement de bloc et un tableau contenant les 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);
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

Le format d'encodage.

samplesPerSecond
Int32

La valeur des échantillons par seconde.

bitsPerSample
Int32

La valeur des bits par échantillon.

channelCount
Int32

La valeur du nombre de canaux.

averageBytesPerSecond
Int32

La valeur des octets moyens par seconde.

blockAlign
Int32

La valeur du BlockAlign.

formatSpecificData
Byte[]

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

S’applique à