This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.46k
stars
4.8k
forks
source link
[BUG] AudioConfig.FromSpeakerOutput( deviceId ) does not function correctly #45473
I enumerated audio devices in windows and selected one - A blue tooth speaker that works in all other applications. The function AudioConfig.FromSpeakerOutput( deviceId ) throws an application exception. I tried the device friendly name, guuid, and other devices. The only output config that works is the default speaker output
Expected behavior
Audio is produced from the specified speaker in the created audio config
Actual behavior
Application exception ( no more detail accessible) - No audio is produced as the config is invalid due to the exception on create. All tested devices worked with default speaker configuration available as SDK function in AudioConfig, just not if specified as shown in the code below.
Reproduction Steps
_logger = logger;
_options = options.Value;
_options.Validate();
_audioConfig = AudioConfig.FromDefaultMicrophoneInput();
SpeechConfig speechConfig = SpeechConfig.FromSubscription(_options.Key, _options.Region);
speechConfig.SpeechRecognitionLanguage = _options.SpeechRecognitionLanguage;
speechConfig.SetProperty(PropertyId.SpeechServiceResponse_PostProcessingOption, "TrueText");
speechConfig.SpeechSynthesisVoiceName = _options.SpeechSynthesisVoiceName;
_speechRecognizer = new SpeechRecognizer(speechConfig, _audioConfig);
var enumerator = new MMDeviceEnumerator();
foreach (var endpoint in
enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active))
{
Console.WriteLine("{0} ({1})", endpoint.FriendlyName, endpoint.ID);
}
// PARTIAL OUTPUT OF ABOVE
//866095fd-cdd4-403c-b889-b745f832bbb7
//Headphones(V8)
var devGuiid = "e838ff77-1f5a-46b8-9af2-52e42c65cacb";
var devName = "Headphones (V8)";
//Application exception thrown here:
_audioOutputConfig = AudioConfig.FromSpeakerOutput( devName );
_speechSynthesizer = new SpeechSynthesizer(speechConfig, AudioConfig.FromSpeakerOutput(devGuiid));
Library name and version
Microsoft.CognitiveServices.Speech v1.38.0
Describe the bug
I enumerated audio devices in windows and selected one - A blue tooth speaker that works in all other applications. The function AudioConfig.FromSpeakerOutput( deviceId ) throws an application exception. I tried the device friendly name, guuid, and other devices. The only output config that works is the default speaker output
Expected behavior
Audio is produced from the specified speaker in the created audio config
Actual behavior
Application exception ( no more detail accessible) - No audio is produced as the config is invalid due to the exception on create. All tested devices worked with default speaker configuration available as SDK function in AudioConfig, just not if specified as shown in the code below.
Reproduction Steps
Environment
Windows 11 - Visual Studio Community 2022