Installation offline Spracherkennung "vosk" auf dem Raspberry 3B

  • Habe die Spracherkennung vosk auf meinem Raspi 3B+ (Buster) installiert.

    Mittels Testprogramm wurde eine vorhandene wav - Datei erfolgreich in Text umgewandelt.

    Ein Mikrofontest mittels der offiziellen Testdatei "test_microphone.py" verlief negativ (Fehlermeldungen).

    Meine Audio-Einstellungen müssten aber eigentlich passen da ich problemlos wav- Dateien erstellen und abspielen kann.

    (Aufnahme : arecord --format=S16_LE --duration=10 --rate=16000 --file-type=wav trial.wav)

    (Abspielen: aplay --format=S16_LE --rate=16000 trial.wav)

    Weiß jemand eine Lösung ?


    Nachtrag vom 10.11.2020

    - Hardware : a) USB-Mikrofon

    b) Lautsprecher (analog) ist über die 3,5mm Klinke angeschlossen


    Fehlermeldungen:

    pi@raspberrypi:~ $ python3 test_microphone.py

    LOG (VoskAPI:ReadDataFiles():vosk/model.cc:192) Decoding params beam=13 max-active=7000 lattice-beam=6

    LOG (VoskAPI:ReadDataFiles():vosk/model.cc:195) Silence phones 1:2:3:4:5:6:7:8:9:10

    LOG (VoskAPI:RemoveOrphanNodes():nnet-nnet.cc:948) Removed 1 orphan nodes.

    LOG (VoskAPI:RemoveOrphanComponents():nnet-nnet.cc:847) Removing 2 orphan components.

    LOG (VoskAPI:Collapse():nnet-utils.cc:1472) Added 1 components, removed 2

    LOG (VoskAPI:CompileLooped():nnet-compile-looped.cc:345) Spent 0.057236 seconds in looped compilation.

    LOG (VoskAPI:ReadDataFiles():vosk/model.cc:219) Loading i-vector extractor from model/ivector/final.ie

    LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:183) Computing derived variables for iVector extractor

    LOG (VoskAPI:ComputeDerivedVars():ivector-extractor.cc:204) Done.

    LOG (VoskAPI:ReadDataFiles():vosk/model.cc:242) Loading HCL and G from model/HCLr.fst model/Gr.fst

    LOG (VoskAPI:ReadDataFiles():vosk/model.cc:264) Loading winfo model/word_boundary.int

    Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

    Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

    ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline

    ALSA lib pcm.c:2565:(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:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

    ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory

    ALSA lib pcm.c:2565:(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:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory

    ALSA lib conf.c:5036:(snd_config_expand) Args evaluate error: No such file or directory

    ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM bluealsa

    Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

    ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave

    Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &alsaPeriodFrames, &dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924

    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 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048

    Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719

    Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843

    Traceback (most recent call last):

    File "test_microphone.py", line 16, in <module>

    stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=8000)

    File "/usr/lib/python3/dist-packages/pyaudio.py", line 750, in open

    stream = Stream(self, *args, **kwargs)

    File "/usr/lib/python3/dist-packages/pyaudio.py", line 441, in __init__

    self._stream = pa.open(**arguments)

    OSError: [Errno -9997] Invalid sample rate

    Edited 2 times, last by mandos ().

  • Die Soundkarte besitzt zwei Anschlussbuchsen für Stecker 3,5mm (1x Lautsprecher , 1x Mikrofon).

    Die Soundkarte wurde automatisch vom System erkannt, die Einrichtung habe ich mittels Lautsprechersymbol (befindet sich oben rechts in der Taskleiste) vorgenommen - die wenigen Maßnahmen sind im Internet gut beschrieben.


    Code