@Saeshav Subash Thanks for getting back. I tried the same above sample, which you had shared, and it worked fine on my Visual Studio Code. So, I believe this is environment specific and not related to the SDK or Azure speech.
See below:
.
.
Plan 1:
On Windows, make sure that your application has permission to access the microphone. You can check this by going to Settings -> Privacy -> Microphone
and ensuring that "Allow apps to access your microphone" is enabled and that Python (or your IDE) is listed and enabled in the app list.
.
.
Plan 2:
Default Microphone Configuration:
Ensure that the default microphone is set correctly. You can set this in Control Panel -> Hardware and Sound -> Sound -> Recording
tab. Right-click on your microphone and select "Set as Default Device".
.
.
Plan 3:
Update Drivers:
Ensure that your microphone drivers are up to date. You can update them through the Device Manager.
.
.
Plan 4:
Code Adjustments:
- Specify the audio input device explicitly in your code. You can list available audio devices and select the appropriate one. Below is an example:
def get_microphone():
# List available audio input devices
audio_config = speechsdk.audio.AudioConfig(use_default_microphone=True) return audio_config
.
.
# Get the audio input from the default microphone
audio_config = get_microphone() speech_recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config, audio_config=audio_config)
.
.
Plan 5:
For your scenario, enable the logging as shown below:
speech_config.set_property(speechsdk.PropertyId.Speech_LogFilename, "LogfilePathAndName")
This might give a detailed log for the cause of the issue.
.
Awaiting your reply.