Bagikan melalui


Note

Please see Azure Cognitive Services for Speech documentation for the latest supported speech solutions.

RecognizerInfo.SupportedAudioFormats Property

Gets the audio formats supported by a SpeechRecognitionEngine instance.

Namespace:  Microsoft.Speech.Recognition
Assembly:  Microsoft.Speech (in Microsoft.Speech.dll)

Syntax

'Declaration
Public ReadOnly Property SupportedAudioFormats As ReadOnlyCollection(Of SpeechAudioFormatInfo)
    Get
'Usage
Dim instance As RecognizerInfo
Dim value As ReadOnlyCollection(Of SpeechAudioFormatInfo)

value = instance.SupportedAudioFormats
public ReadOnlyCollection<SpeechAudioFormatInfo> SupportedAudioFormats { get; }

Property Value

Type: System.Collections.ObjectModel.ReadOnlyCollection<SpeechAudioFormatInfo>
Returns a list of audio formats supported by a specific SpeechRecognitionEngine instance.

Examples

The following example implements a button click that displays all the information in a RecognizerInfo instance. The example uses the SupportedAudioFormats property to obtain the encoding formats supported by a recognition engine configuration, and then displays it in a MessageBox.

private void recognizerInfoButton_Click(object sender, EventArgs e) 
{
  RecognizerInfo info = _recognizer.RecognizerInfo;
  string AudioFormats = "";
  foreach (SpeechAudioFormatInfo fmt in info.SupportedAudioFormats) 
  {
    AudioFormats += String.Format("       {0}\n",
      fmt.EncodingFormat.ToString());
  }
  string AdditionalInfo = "";
  foreach (string key in info.AdditionalInfo.Keys) 
  {
    AdditionalInfo += String.Format("      {0}: {1}\n", key, info.AdditionalInfo[key]);
  }
  MessageBox.Show(String.Format(
                          "Name:                 {0 }\n" +
                          "Description:          {1} \n" +
                          "SupportedAudioFormats:\n" +
                          "{2} " +
                          "Culture:              {3} \n" +
                          "AdditionalInfo:       \n" +
                          " {4}\n",
                          info.Name.ToString(),
                          info.Description.ToString(),
                          AudioFormats,
                          info.Culture.ToString(),
                          AdditionalInfo));
}

See Also

Reference

RecognizerInfo Class

RecognizerInfo Members

Microsoft.Speech.Recognition Namespace

RecognizerInfo

ReadOnlyCollection

SpeechRecognitionEngine

SpeechAudioFormatInfo