vosk-server
vosk-server copied to clipboard
Malformed HTTP message when using arecord to send audio from Raspberry Pi
Hello -- when trying to send live audio to vosk-server kaldi-en running on a remote server using the following code on the rPi client...
arecord --buffer-time=5000000 -D plughw:2,0 -f cd -t raw | nc -N 10.0.1.10 2700
...I get the following error on the client:
Recording raw data 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
HTTP/1.1 400 Bad Request
Date: Mon, 01 Feb 2021 04:30:50 GMT
Server: Python/3.7 websockets/7.0
Content-Length: 23
Content-Type: text/plain
Connection: close
Malformed HTTP message
The server is definitely up and running, but seems to always send a 400 error. I am using the final line of code on this Kaldi documentation page as my example, because it's all I was able to find:
https://kaldi-asr.org/doc/online_decoding.html
I am unable to find any additional information in the server logs. Any idea how I can troubleshoot this? Thanks!
This command line with netcat is not going to work, you have to use client libraries working over websocket protocol, the microphone example is here:
https://github.com/alphacep/vosk-server/blob/master/websocket/test_microphone.py
@nshmyrev Got it, thanks -- and please excuse my ignorance on that point. Tried using test_microphone.py on this Raspberry Pi 3b, installing missing dependencies as I went, but got stuck trying to sort out an issue with pyaudio and portaudio version mismatch. Would be great in future if there were a self-contained way (e.g., docker container) to spin up a client's ability to transmit back to the server. I can imagine this type of use case might be helpful for others (low-powered rPi as a remove mic/capture device streaming audio back to a more powerful central server for processing). The server setup was brilliantly easy w/ the container, but as of now it seems quite difficult to get a client stream working (at least for someone with only beginner knowledge). Just my thoughts, thanks!