Språk

SpeechAudioFormatInfo Konstruktorer

Definition

Initierar en ny instans av SpeechAudioFormatInfo klassen.

Överlagringar

Name Description
SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Initierar en ny instans av SpeechAudioFormatInfo klassen och anger exemplen per sekund, bitar per exempel och antalet kanaler.

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

Initierar en ny instans av SpeechAudioFormatInfo klassen och anger kodningsformat, exempel per sekund, bitar per exempel, antal kanaler, genomsnittliga byte per sekund, blockjusteringsvärde och en matris som innehåller formatspecifika data.

SpeechAudioFormatInfo(Int32, AudioBitsPerSample, AudioChannel)

Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs

Initierar en ny instans av SpeechAudioFormatInfo klassen och anger exemplen per sekund, bitar per exempel och antalet kanaler.

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)

Parametrar

samplesPerSecond
Int32

Värdet för exemplen per sekund.

bitsPerSample
AudioBitsPerSample

Värdet för bitarna per exempel.

channel
AudioChannel

En medlem i AudioChannel uppräkningen (som anger Mono eller Stereo).

Exempel

I följande exempel visas en typisk användning av SpeechAudioFormatInfo för att ange formatet för ljud för utdata till en WAV-fil. Instansen SpeechAudioFormatInfo är ett argument för SetOutputToWaveFile metoden.

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

Gäller för

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

Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs
Källa:
SpeechAudioFormatInfo.cs

Initierar en ny instans av SpeechAudioFormatInfo klassen och anger kodningsformat, exempel per sekund, bitar per exempel, antal kanaler, genomsnittliga byte per sekund, blockjusteringsvärde och en matris som innehåller formatspecifika data.

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

Parametrar

encodingFormat
EncodingFormat

Kodningsformatet.

samplesPerSecond
Int32

Värdet för exemplen per sekund.

bitsPerSample
Int32

Värdet för bitarna per exempel.

channelCount
Int32

Värdet för kanalantalet.

averageBytesPerSecond
Int32

Värdet för genomsnittliga byte per sekund.

blockAlign
Int32

Värdet för BlockAlign.

formatSpecificData
Byte[]

En bytematris som innehåller formatspecifika data.

Gäller för