Hello all,
I just finished my setup where I can digitally stream my audio from the desktop PC to a CamillaDSP server connected to the speakers. This took me two days to get running properly, so I wanted to post here a breakdown of it. Hopefully it will help some of you.
Hereby I want to thank Henrik of CamillaDSP for the great tool and its just as great documentation. Without the documentation and all support files, I wouldn't have been able to set this up. Great job from him really. So nice now to just use the browser to setup my DSP and also to know that all I need is a sound card and a low cost PC for such precision DSP work.
I just finished my setup where I can digitally stream my audio from the desktop PC to a CamillaDSP server connected to the speakers. This took me two days to get running properly, so I wanted to post here a breakdown of it. Hopefully it will help some of you.
- Desktop PC as source
- Ubuntu with Pulseaudio
- Pulseaudio resamples all to 96kHz with speex-float-5
- PA uses 0.3% CPU still after this, on a Ryzen 5700g
- PA transmits to network using rtp module (Only 16 bit integer was possible.)
load-module module-null-sink sink_name=rtp_2_camilla channels=2 format=S16BE rate=96000 sink_properties="device.description='RTP to CamillaDSP'" load-module module-rtp-send source=rtp_2_camilla.monitor destination_ip=192.168.0.22 port=46908
- Running pulseaudio with -vvvv, I find all the RTP settings as SDP data. I put these in attached sdp file.
- Raspberry Pi with Raspbian OS 64 - Server for DSP
- Uninstalled Pulseaudio, only using Alsa
- Installed ffmpeg, camilladsp, all other dependencies
- Running attached Python script to check for incoming streams
- Pings my desktop PC to see if it is on. It shuts down the amplifier if there is no ping response.
- If my desktop PC pings back, script will turn on the amplifier and run ffmpeg to check for RTP stream.
- Uses the sdp file to recognize the incoming stream
- ffmpeg outputs the stream to snd-aloop loopback device at hw:0
- This creates a virtual device for Alsa and makes it possible to capture audio from an application, in my case ffmpeg.
- Channel count needed to be corrected for snd-aloop, to match the RTP that has 2 channels. By default it has 8 channels.
$ cat /etc/modprobe.d/sound.conf alias alsa-loopback snd-aloop options snd-aloop pcm_substreams=2,2 index=0,0 enabled=1,1
- It is tricky to minimize delay of this RTP stream but I believe I found good settings. See inside the Python script.
- CamillaDSP captures from loopback and does its DSP magic
- CamillaDSP is running as service using camilladsp.service file from camilldsp-config repository
- Rate adjust has to be on - otherwise stream falls out of sync with sound card
- For the capture input I had to select not just the card but the device under the card. It had to be hw:0,1 and not just hw:0 apparently (hw:0,0 is playback, hw:0,1 is capture). This took me HOURS to figure out.. oh God 🙂
- CamillaDSP plays output to USB sound card
- I had to disable hdmi audio and onboard audio by editing the /boot/config.txt. Otherwise sound card number in alsa was changing sometimes.
dtoverlay=vc4-kms-v3d,noaudio # dtparam=audio=on
- While editing the /boot/config.txt, I also overclocked the Raspberry Pi to 2147MHz
- Used the 'Alsa instructions' within the documentation of camilladsp to find what formats are supported (192kHz and S32LE with my Behringer UMC204HD)
- I had to disable hdmi audio and onboard audio by editing the /boot/config.txt. Otherwise sound card number in alsa was changing sometimes.
- 2ms in local PC Pulseaudio RTP stream output (checked with $pactl list sinks)
- About 20ms I believe for ffmpeg to receive package from network and send to Alsa
- No latency expected from loopback device in Alsa
- Latency inside CamillaDSP - Buffer level is dancing around 1000 samples. My settings are: 192kHz sampling, 1024 chunk size, max queue of 4. Not sure what my latency is, I didn't understand if queue length is set to 4 or another value currently.
- Latency from USB port and sound card - not sure how much
Hereby I want to thank Henrik of CamillaDSP for the great tool and its just as great documentation. Without the documentation and all support files, I wouldn't have been able to set this up. Great job from him really. So nice now to just use the browser to setup my DSP and also to know that all I need is a sound card and a low cost PC for such precision DSP work.
Attachments
Last edited: