RecognizerInfo.SupportedAudioFormats Property
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the audio formats supported by a SpeechRecognizer or SpeechRecognitionEngine instance.
public:
property System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::AudioFormat::SpeechAudioFormatInfo ^> ^ SupportedAudioFormats { System::Collections::ObjectModel::ReadOnlyCollection<System::Speech::AudioFormat::SpeechAudioFormatInfo ^> ^ get(); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.AudioFormat.SpeechAudioFormatInfo> SupportedAudioFormats { get; }
member this.SupportedAudioFormats : System.Collections.ObjectModel.ReadOnlyCollection<System.Speech.AudioFormat.SpeechAudioFormatInfo>
Public ReadOnly Property SupportedAudioFormats As ReadOnlyCollection(Of SpeechAudioFormatInfo)
Returns a list of audio formats supported by a specific SpeechRecognizer or SpeechRecognitionEngine instance.
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));
}
Product | Versions |
---|---|
.NET | 8 (package-provided), 9 (package-provided), 10 (package-provided) |
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0 (package-provided) |
.NET feedback
.NET is an open source project. Select a link to provide feedback: