SpeechAudioFormatInfo Construtores

Definição

Inicializa uma nova instância da SpeechAudioFormatInfo classe.

Sobrecargas

Name Descrição
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Inicializa uma nova instância da SpeechAudioFormatInfo classe e especifica as amostras por segundo, bits por amostra e o número de canais.

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

Inicializa uma nova instância da SpeechAudioFormatInfo classe e especifica o formato de codificação, amostras por segundo, bits por amostra, número de canais, média de bytes por segundo, valor de alinhamento de blocos e um array contendo dados específicos do formato.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs

Inicializa uma nova instância da SpeechAudioFormatInfo classe e especifica as amostras por segundo, bits por amostra e o número de canais.

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)

Parâmetros

samplesPerSecond
Int32

O valor das amostras por segundo.

bitsPerSample
AudioBitsPerSample

O valor dos bits por amostra.

channel
AudioChannel

Um membro da AudioChannel enumeração (indicando Mono ou Stereo).

Exemplos

O exemplo seguinte mostra uma utilização típica de SpeechAudioFormatInfo para especificar o formato do áudio a sair para um ficheiro WAV. A SpeechAudioFormatInfo instância é um argumento para o SetOutputToWaveFile método.

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

Aplica-se a

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

Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs
Origem:
SpeechAudioFormatInfo.cs

Inicializa uma nova instância da SpeechAudioFormatInfo classe e especifica o formato de codificação, amostras por segundo, bits por amostra, número de canais, média de bytes por segundo, valor de alinhamento de blocos e um array contendo dados específicos do formato.

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

Parâmetros

encodingFormat
EncodingFormat

O formato de codificação.

samplesPerSecond
Int32

O valor das amostras por segundo.

bitsPerSample
Int32

O valor dos bits por amostra.

channelCount
Int32

O valor para a contagem de canais.

averageBytesPerSecond
Int32

O valor dos bytes médios por segundo.

blockAlign
Int32

O valor do BlockAlign.

formatSpecificData
Byte[]

Um array de bytes contendo os dados específicos do formato.

Aplica-se a