synesthesiam / voice2json

Command-line tools for speech and intent recognition on Linux
MIT License
1.09k stars 63 forks source link

Raspberry Pi Docker Image - USB Audio issues #21

Closed infinitymakerspace closed 4 years ago

infinitymakerspace commented 4 years ago

Hi guys, thanks for all the help thus far. I am at a point where I test with transcribe stream. I am using a USB sound card and its set as default on the Raspberry Pi in Alsamixer.

When running the voice2json transcribe-stream, I am reveiving this response.

pi@raspberrypi:~ $ voice2json transcribe-stream ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM default arecord: main:828: audio open error: No such file or directory

I have seen an issue that is still open and looked at that and ran the following , with no joy... pi@raspberrypi:~ $ voice2json transcribe-stream --device /dev/snd:/dev/snd usage: voice2json [-h] [--profile PROFILE] [--base-directory BASE_DIRECTORY] [--certfile CERTFILE] [--keyfile KEYFILE] [--setting SETTING SETTING] [--machine MACHINE] [--debug] {print-version,print-profile,print-downloads,print-files,train-profile,transcribe-wav,transcribe-stream,recognize-intent,record-command,wait-wake,pronounce-word,generate-examples,record-examples,test-examples,show-documentation,speak-sentence} ... voice2json: error: unrecognized arguments: --device /dev/snd:/dev/snd pi@raspberrypi:~ $

somehow the docker image isnt working from the usb sound device, but I am slightly lost.

synesthesiam commented 4 years ago

Looks like you're getting close :)

The --device argument is meant for the docker run command. Having Docker see your microphone can be a tough thing, so you may just want to pipe audio in via standard in:

$ arecord -r 16000 -f S16_LE -c 1 | voice2json transcribe-stream --audio-source -

You can pass -D to arecord to change the device (see arecord -L for a list).

You might also try editing the voice2json Docker script and removing the --user argument. That runs the Docker container as your current user, but I've found it sometimes won't be able to access my microphone. Beware that your voice2json profile will be owned by root if you do this.

infinitymakerspace commented 4 years ago

Thank you so much for the rapid response will do that first thing in the AM as its currently 21:18 South Africa Time.

On Thu, 09 Jul 2020, 20:53 Michael Hansen, notifications@github.com wrote:

Looks like you're getting close :)

The --device argument is meant for the docker run command. Having Docker see your microphone can be a tough thing, so you may just want to pipe audio in via standard in:

$ arecord -r 16000 -f S16_LE -c 1 | voice2json transcribe-stream --audio-source -

You can pass -D to arecord to change the device (see arecord -L for a list).

You might also try editing the voice2json Docker script and removing the --user argument. That runs the Docker container as your current user, but I've found it sometimes won't be able to access my microphone. Beware that your voice2json profile will be owned by root if you do this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/synesthesiam/voice2json/issues/21#issuecomment-656293865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOR357256MIBCRX64DGGBMTR2YGZNANCNFSM4OV2JHXA .

infinitymakerspace commented 4 years ago

Ok so First I try

pi@raspberrypi:~ $ arecord -r 16000 -f S16_LE -c 1 | voice2json transcribe-stream --audio-source - Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono {"text": "", "likelihood": 0, "transcribe_seconds": 0, "wav_seconds": 0, "tokens": null, "timeout": false} {"text": "", "likelihood": 0.19661878419905868, "transcribe_seconds": 2.973578785999962, "wav_seconds": 0.00475, "tokens": [{"token": "", "start_time": 3.13, "end_time": 3.57, "likelihood": 0.9996000336374518}, {"token": "", "start_time": 3.58, "end_time": 4.29, "likelihood": 1.0}], "timeout": false} {"text": "", "likelihood": 0, "transcribe_seconds": 0, "wav_seconds": 0, "tokens": null, "timeout": false} {"text": "", "likelihood": 0, "transcribe_seconds": 0, "wav_seconds": 0, "tokens": null, "timeout": false}

I can see the usb audio blinking and cpu doing routines but I cannot figure it out if it understood the word. I used the word "start"

Then I tried

pi@raspberrypi:~ $ arecord -r 16000 -f S16_LE -c 1 | voice2json transcribe-stream | voice2json recognize-intent Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 16000 Hz, Mono ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2564:(snd_pcm_open_noupdate) Unknown PCM default arecord: main:828: audio open error: No such file or directory read unix @->/var/run/docker.sock: read: connection reset by peer

I have come far with this attempt, while I wait on reply I will setup another card with the armhf deb package and see If I can get to this part which I have not been able to do with the debian package for some off reason.

Many thanks for you help so far

On Thu, 9 Jul 2020 at 20:53, Michael Hansen notifications@github.com wrote:

Looks like you're getting close :)

The --device argument is meant for the docker run command. Having Docker see your microphone can be a tough thing, so you may just want to pipe audio in via standard in:

$ arecord -r 16000 -f S16_LE -c 1 | voice2json transcribe-stream --audio-source -

You can pass -D to arecord to change the device (see arecord -L for a list).

You might also try editing the voice2json Docker script and removing the --user argument. That runs the Docker container as your current user, but I've found it sometimes won't be able to access my microphone. Beware that your voice2json profile will be owned by root if you do this.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/synesthesiam/voice2json/issues/21#issuecomment-656293865, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOR357256MIBCRX64DGGBMTR2YGZNANCNFSM4OV2JHXA .

infinitymakerspace commented 4 years ago

Got the system working with deb package and correctly configuring usb audio device

jonnyAnd commented 1 year ago

Old issue - but for anyone who had issues with getting audio with docker going, i had success with a quick demo setup here: https://github.com/jonnyAnd/voice2json-Docker-Compose