quiniouben / vban

VBAN protocol open-source implementation
GNU General Public License v3.0
450 stars 63 forks source link

Alsa errors with vban_emitter #59

Closed robwmi closed 3 years ago

robwmi commented 3 years ago

I just set up a Raspberry Pi 3 Model B+ with the Raspian OS and a USB audio adapter. I am able to record and playback audio using the following:

$ arecord -f S16_LE -d 10 -r 44100 --device="hw:2,0" test_mic2.wav
Recording WAVE 'test_mic2.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

$ aplay test_mic2.wav
Playing WAVE 'test_mic2.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Mono

I configured vban using simply ./configure

After playing with different emitter options, the following seems to be the closest to success that I've come, but after several seconds I get the error messages below:

$ sudo vban_emitter -i ##.##.0.6 -p 6980 -s Stream3 -c1 -n 1 --device="hw:2,0" -r 44100 --loglevel=4

vban_emitter version 2.1.0

Info: socket_open: opening socket with port 6980 Info: socket_open with port: 6980 Info: audio_init: config is direction in, backend , device hw:2,0, buffer size 1024 Info: audio_backend_get_by_name: taking default backend alsa Info: audio_set_map_config: new map config is nb channels 1 Info: audio_set_stream_config: new stream config is nb channels 1, sample rate 44100, bit_fmt 16I Debug: alsa_open: snd_pcm_open Debug: audio_read invoked with size 512 Error: alsa_read: snd_pcm_writei failed: Input/output error Error: alsa_read: snd_pcm_writei failed: Input/output error Error: audio_read: backend read failed Info: socket_close: closing socket with port 6980

I've had good success Googling, and experimenting up to this point, but now I seem to be stuck! I have lots of programming background, a bit of linux experience, have been using VBAN on Windows, but have no experience at all with Alsa. Any suggestions for further debugging, or hints on what might be wrong would be appreciated!

Thank you, Rob

quiniouben commented 3 years ago

Hi, sorry for the delay in answering. Could your problem has to do with the device name ? As mentioned in issue #56 , the device name to use is the one given by arecord -L and not arecord -l

robwmi commented 3 years ago

No, I don't thinks so. I saw that, and went with the hardware device identifier instead of the name, and it works with Alsa. Unless the requirements are different when working with vban_emitter - that possibility hadn't occurred to me until just now, but I'm assuming that vban_emitter is just passing the parameter on to Alsa.

Thanks for the suggestion; I'll experiment a little more.

robwmi commented 3 years ago

I'm happy to report that the solution for this error is simple, if not quick. Simply go away for several weeks, then return, and repeat the experiment without modification! I had saved my vban command in a script. I came back, and ran the script, and received a different set of error messages! These were solved by compiling your alsaSetParamsRework branch, and I'm now successfully running VBAN on my Raspberry Pi! I further claim that I'm not insane.

I'm quite interested to contribute to your project in hopes of expanding its functionality and stability. If you have suggestions for me on where to start (merging the two branches, perhaps?), I'd be interested to know. Thank you!

quiniouben commented 3 years ago

Happy to read that things got solved. As you can notice, I fail to find time to be active in this project. Your offer to participate is very welcome. Improving the alsa support for more setups is probably an interesting task. Another one could be to push the jack backend for the emitter direction. In any case, I will close the issue, as it seems you now have a working setup.