I coupled my DAB module - which is a i2s master device - hence set Banana Pi as i2s slave (in fex file). The connection can be tested with alsa record / play utils ..
arecord -D hw:2 -f S16_LE -c 2 -r 48000 | aplay -D hw:3 -
where hw2: is the i2s input alsa device (the DAB input); hw:3 is the usb sound card
Once the i2s input is proved working, its time to stream this input to my laptop at 192.168.99.130, udp port 5000. The gstreamer pipeline at Banana Pi end is:
gst-launch-0.10 alsasrc device=hw:2 ! 'audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000,channels=(int)2'! udpsink host=192.168.99.130 port=5000
and at my laptop:
gst-launch udpsrc port=5000 ! 'audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000,channels=(int)2' ! pulsesink
and to play in vlc :
vlc --demux=rawaud --rawaud-channels=2 --rawaud-samplerate=48000 udp://@:5000
The raw audio datarate for 48k sample rate, S16LE stereo is 1536 Kbits/s. This can easily be handled in a wifi connection, and I had no issues streaming raw over udp. The aggregate data rate will be around with 1.6Mbits/s . If this needs to be carried out in a leaner channel (i.e bluetooth) then opus encoder / decoder is an excellent choice.The opus encoded pipeline is:Server : (Banana Pi)
gst-launch-0.10 alsasrc device=hw:2 ! 'audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, width=(int)16, depth=(int)16, rate=(int)48000,channels=(int)2' ! opusenc ! udpsink host=192.168.99.130 port=5000
client:
gst-launch udpsrc port=5000 ! opusdec ! pulsesink
The processor usage for the raw pipeline is about 6~7% and for the opus encoded pipeline is ~25% - excellent !!
No comments:
Post a Comment