Uberi / speech_recognition

Speech recognition module for Python, supporting several engines and APIs, online and offline.
https://pypi.python.org/pypi/SpeechRecognition/
BSD 3-Clause "New" or "Revised" License
8.44k stars 2.4k forks source link

Cant understand what i said #589

Open Impre-visible opened 2 years ago

Impre-visible commented 2 years ago

Steps to reproduce

  1. When i try my code with a specifi mic, who i want i have an error

  2. 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}")
  3. 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 work

I installed PocketSphinx from pip.

Impre-visible commented 2 years ago

my microphone is the 15