Hi,
Ich versuche nun schon seit mehreren Stunden ein USB Mikrofon auf dem Raspberry Pi zum laufen zu bekommen.
Ich hab es angeschlossen und anschließend mit
Anschließend wollte ich das Mikrofon über das Einstellungsfenster für Input als default hinterlegen, allerdings resettet sich die Einstellung beim schließen jedesmal.
Habe dann rumgegoogelt und angeblich kann man das indem man die
Dann hab ich das minimalste Python Script zur Spracherkennung geschrieben und laufen lassen:
Das Beispiel nutzt Ubeeris Speechrecognition, die unter anderem PyAudio verwendet. Beides habe ich mit pip installiert inklusive aller benötigten dependencies.
Beim Ausführen bekommen ich diese Fehlermeldung:
Kann mir irgendjemand helfen das in Ordnung zu bringen?
Ich versuche nun schon seit mehreren Stunden ein USB Mikrofon auf dem Raspberry Pi zum laufen zu bekommen.
Ich hab es angeschlossen und anschließend mit
arecord -l
geschaut ob es erkannt wird:Anschließend wollte ich das Mikrofon über das Einstellungsfenster für Input als default hinterlegen, allerdings resettet sich die Einstellung beim schließen jedesmal.
Habe dann rumgegoogelt und angeblich kann man das indem man die
/usr/share/alsa/alsa.conf
bearbeitet. Hab ich getan:Dann hab ich das minimalste Python Script zur Spracherkennung geschrieben und laufen lassen:
Quellcode
- import speech_recognition as sr
- recognizer = sr.Recognizer()
- def listen_to_microphone():
- with sr.Microphone(1) as source:
- audio = recognizer.listen(source)
- return audio
- def try_recognize_audio(audio, language):
- try:
- return recognizer.recognize_google(audio, language=language).lower()
- except sr.UnknownValueError:
- #print("Google Speech Recognition could not understand audio")
- pass
- except sr.RequestError as e:
- pass
- while True:
- audio = listen_to_microphone()
- print(try_recognize_audio(audio, "de-DE"))
Das Beispiel nutzt Ubeeris Speechrecognition, die unter anderem PyAudio verwendet. Beides habe ich mit pip installiert inklusive aller benötigten dependencies.
Beim Ausführen bekommen ich diese Fehlermeldung:
Quellcode
- ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
- ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.front.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM front
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround51.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround51.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround21
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround40.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround40
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround51.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround41
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround51.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround50
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround51.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround51
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'cards.USB-Audio.pcm.surround71.1:CARD=1'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM surround71
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
- ALSA lib confmisc.c:1281:(snd_func_refer) Unable to find definition 'defaults.bluealsa.device'
- ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
- ALSA lib conf.c:4996:(snd_config_expand) Args evaluate error: No such file or directory
- ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM bluealsa
- ALSA lib pcm_dmix.c:1052:(snd_pcm_dmix_open) unable to open slave
- Cannot connect to server socket err = No such file or directory
- Cannot connect to server request channel
- jack server is not running or cannot be started
- JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
- JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
- Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
- Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
- Traceback (most recent call last):
- File "test.py", line 21, in <module>
- audio = listen_to_microphone()
- File "test.py", line 6, in listen_to_microphone
- with sr.Microphone(1) as source:
- File "/home/pi/.local/lib/python2.7/site-packages/speech_recognition/__init__.py", line 141, in __enter__
- input=True, # stream is an input stream
- File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 750, in open
- stream = Stream(self, *args, **kwargs)
- File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 441, in __init__
- self._stream = pa.open(**arguments)
- IOError: [Errno -9998] Invalid number of channels
Kann mir irgendjemand helfen das in Ordnung zu bringen?
faxe1008