RuntimeError: new_Ad returned -1

前端 未结 1 1074
挽巷
挽巷 2020-12-18 17:45
pocketsphinx_continuous -adcdev plughw:1,0 -inmic yes -dict 4711.dic -lm 4711.lm

The above command works but the problem arises in running python c

相关标签:
1条回答
  • 2020-12-18 18:16

    You are probably experiencing it with USB microphone (e. g. on RaspberryPi). It tells you, that LiveSpeech doesn't know, which audio device to use for input. Luckily according to https://github.com/bambocher/pocketsphinx-python#default-config there are several configuration options - so you need to specify audio_device.

    basically lets do:

    for phrase in LiveSpeech(audio_device=3): print(phrase)
    

    where 3 please replace with your desired microphone ID. Now how to get it:

    import pyaudio
    
    p = pyaudio.PyAudio()
    for i in range(p.get_device_count()):
        print(p.get_device_info_by_index(i))
    #otherwise you can do:
    print(p.get_default_input_device_info())
    

    There are several topics on how to properly set up USB microphone on RaspberryPi - if its your case, let me know.

    0 讨论(0)
提交回复
热议问题