When i try my code with a specifi mic, who i want i have an error
But if i use the command python -m speech_recognition it work and i dont know why
def parler(): # get the user voice and analyse it
with open(settings, 'r', encoding='utf-8') as f:
config = json.load(f)
r = sr.Recognizer()
mic = sr.Microphone(device_index=int(config['microId'])) # get the microphone id
print(mic)
with mic as source:
print("Analyse du bruit de fond...")
r.adjust_for_ambient_noise(source, duration = 5)
print("Speak!")
r.pause_threshold = 1
audioData = r.listen(source)
print("End!")
print(type(audioData))
print(getsizeof(audioData))
result = r.recognize_google(audioData, show_all = True)
say(f"Vous avez dit {result}")
My working microphones are: (You can check this by running python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())".) the command dont work
Steps to reproduce
When i try my code with a specifi mic, who i want i have an error
But if i use the command python -m speech_recognition it work and i dont know why
The script load or create a config file, there is the full code : https://pastebin.com/vb8nV4Ni
Expected behaviour
i want to recognize what i said
Actual behaviour
i have no error, just it dont work
System information
My system is Windows 10 x64.
My Python version is 3.10.0.
My Pip version is 21.2.3.
My SpeechRecognition library version is 3.8.1.
My PyAudio library version is 0.2.11.
My microphones are: https://pastebin.com/i6H5SGqt
My working microphones are: (You can check this by running
python -c "import speech_recognition as sr;print(sr.Microphone.list_working_microphones())"
.) the command dont workI installed PocketSphinx from pip.