• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

RPi4 + CamillaDSP Tutorial

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Intent of this thread is to provide a tutorial for setting up CamillaDSP on a RPi4. There is a lot of good information scattered through ASR, DIYAudio and the CamillaDSP GitHub but there also appears to be a lot of apprehension. My goal is to give concrete examples of how to use CamillaDSP with a variety of hardware to ease some of that apprehension.

I realize this tutorial is long and looks daunting. I felt the same way when trying to figure this stuff out. My advice is to take it step by step, go slowly and ask questions. Some DIY projects are not worth the effort but this one is. At the end of this project you will have a DSP with almost unparalleled processing power in a very small form factor, easily configured via web interface all at a very low cost compared to commercial options.

I would like to especially thank @HenrikEnquist for developing CamillaDSP. I’ve long been skeptical of computer-based DSP but CamillaDSP is a game changer. It runs on minimal hardware, is easy to interface with a variety of devices and is exceptionally well designed. I’ve replaced all of my miniDSP systems with RPi4s running CamillaDSP and could not be happier.

The tutorial is divided in to 4 parts, Part 1 talks through CamillaDSP background, Part 2 covers initial CamillaDSP setup, Part 3 documents specific CamillaDSP configuration files for various multichannel DACs and Part 4 talks covers advanced topics such as the GUI, displays, IR receivers, trigger output options and cases.

This thread started from the ASR Open Source Streamer thread. I would like to thank everyone that participated in that thread as it pushed me to explore computer-based DSP. As this thread is more about how to use CamillaDSP rather than how to build a streamer (although that will also be covered!) I decided it was better to start a new thread.

I am not a programmer or DSP expert, my primary motivation is finding better ways to implement DIY active speakers. If you see a better way of doing something or want further explanation please speak up! These instructions have been developed as I learned how to implement CamillaDSP and found better ways to set it up but I am always learning.

As of 10/20/2022 I am now linking old versions of this tutorial in zip form with all screenshots and attachments to this post for future reference. I only plan to save the old versions when there are major revisions. In general I am attempting to maintain the existing step numbering to ensure that the discussion makes sense for updated versions of the tutorial. I am also switching to more generic username / hostname nomenclature instead of the previous michael3 / raspberrypi3 examples.

Old Versions
10/20/2022 Archive
12/12/2023 Archive

Revision Log
01/18/2022: Fixed error with quotation mark in squeezelite configuration instructions.
01/19/2022: Added 1 dB attenuation to all output channels of Okto configuration to avoid digital clipping. Added further discussion about digital clipping when using downstream volume control. Added dates to configuration files.
01/20/2022: Revised instructions for ALSA loopback to run sudo apt install linux-modules-extra-raspi instead of sudo apt install linux-modules-extra-$(uname -r). This should allow the loopback to persist through kernel updates without running any additional commands.
01/26/2022: Added brief notes on specific micro SD card models.
01/27/2022: Small editorial changes, thanks @Wirrunna for the feedback.
02/01/2022: Updated case pictures to match attached drawings.
03/29/2022: Updated following:
+Added more detail on how to install and use WSL
+Added guidance on how to copy / paste in to terminal
+Added guidance on how to use scp to copy files to RPi
+Added steps for starting camilladsp and camillagui from terminal before implementing service
+Added logging to camilladsp service
+Updated flirc.py and oled.py with source switching functionality
+Added video of display
03/31/2022: Moved ALSA Loopback installation step sooner.
04/10/2022: Added instructions to implement bluetooth using bluez-alsa.
04/26/2022: Minor updates for use with Ubuntu Server 22.04 64 bit.
05/04/2022: Updated to reflect CamillaDSP V1.0.0 release. Changed to using symlink configuration file.
05/22/2022: Slight update to reflect that SPDIF input works on Focusrite 18i20 2nd gen as Ubuntu 22.04.
07/17/2022: Updated flirc.py and oled.py to implement mute functionality bound to KEY_LEFT.
07/21/2022: Added upgrade instructions and revised to use CamillaDSP V1.0.1 and rc5 GUI.
08/11/2022: Minor update to flirc.py to better integrate with GUI.
08/16/2022: Removed all directory changes to make installation easier.
10/20/2022: Major update for Ubuntu 22.10 and V1.0.2 CamillaDSP and V1.0.0 CamillaGUI
11/29/2022: Minor update to reflect V1.0.3 CamillaDSP and V1.0.1 CamillaGUI
11/30/2022: Updated following:
+Changed to single flirc.py routine as a result of CamillaDSP mute behavior changes
+Implemented improved configuration switching in flirc.py and oled.py
+Updated oled.py to eliminate display anomalies when switching from longer to short text strings
02/21/2022: Added performance improvements to oled.py based on feedback from @LandscapeJohn.
03/25/2023: Changed recommended display mounting hardware for 10 mm faceplate from 5 mm to 3 mm long screws.
04/18/2023: Updated oled.py with option for smaller volume font with tenths place. Also updated flirc.py to with option for 0.5 dB volume increments.
04/20/2023: Updated oled.py with option to display clipped samples instead of CDSP status.
04/25/2023: Minor update to give option for Ubuntu Server 23.04 64 bit.
07/17/2023: Minor update to use WantedBy=multi-user.target instead of WantedBy=graphical.target for all services.
12/15/2023: Major update to reflect V2.0.0 CamillaDSP and CamillaGUI.
03/02/2024: Minor update to reflect V2.0.3 CamillaDSP and V2.1.0 CamillaGUI.
03/14/2024: Updated oled-rpi.gpio.py and oled-lgpio.py to use optimized code, oled-lgpio.py is now significantly faster.
03/15/2024: Updated oled-rpi.gpio.py and oled-lgpio.py to use set_sleep_mode to avoid wiping effect.
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Part 1: CamillaDSP Background

Why would I want to use CamillaDSP on a RPi4?

This tutorial is geared towards 2 channel audio as it is somewhat difficult to get multichannel audio in to a RPi4. Typical applications are DIY active speakers / subwoofers such as Directiva R1 (4+ channels), LXmini + sub(s) or LX 521.4 (8+ channels). Another good application is passive stereo speakers with 3+ subwoofers. CamillaDSP makes the most sense for applications over 4 channels as the miniDSP Flex offers 4 channel DSP with good analog performance at a very reasonable price. You can do a 4 channel RPi4 + CamillaDSP setup for less cost than the Flex and such a setup has a few advantages, such as more processing power and volume control with dynamic loudness. Although it is possible to use other hardware with CamillaDSP, a RPi4 offers GPIO pins which are useful for integrating a display and has the ability to be used as a USB gadget.

At a high level how does this work?

Starting point is a RPi4 (2 GB, 4 GB or 8 GB are all fine) running Ubuntu Server 64 bit. I prefer Ubuntu Server as it is very stable and works well with all multichannel DACs mentioned in this tutorial (and historically had a newer kernel than Raspberry Pi OS and other audio distros). We will set up CamillaDSP such that it is always running on the RPi4 as a service. A web browser based GUI is available to configure CamillaDSP after initial setup. CamillaDSP requires a capture device and playback device, the capture device is your input and playback device is your output.

The capture device can be a variety of things, it can be the RPi itself with software audio players such as squeezelite or shairport-sync playing to an ALSA loopback, it can be the same device as the playback device in the case of an audio interface with analog/digital inputs or it can be a separate device such as a TOSLINK to USB card. The main point here is that CamillaDSP is NOT limited to applications that use a RPi as a source.

The playback device is either a USB DAC/DDC, HDMI output of the RPi or HAT DAC/DDC. This tutorial will focus on USB DACs. Between the capture device and the playback device is where the magic happens, CamillaDSP can implement channel routing, IIR filters, FIR filters, volume control (w/ dynamic loudness), resampling and delay. The RPi4 is surprising powerful and is able to do much more than any miniDSP product that exists today.

What DACs do you recommend?

1) Okto dac8 PRO - €1295, 8 channel balanced analog output, 8 channel AES digital input, 2 channel AES digital output, 1RU full-rack, volume knob, IR remote control, 5 V trigger, large display, excellent analog performance and overall design. Probably the highest performance 8 channel DAC but availability is an issue and long term support may be a concern. Okto dac8 PRO ASR Review.

2) MOTU Ultralite Mk5 - $600, 10 channel balanced analog output, 8 channel balanced analog input, TOSLINK input / output (can also do ADAT), SPDIF input / output, volume knob capable of controlling all analog outputs, 1RU half-rack, overall good analog performance. I recommend this DAC for most applications due to good analog performance, superior I/O functionality, reasonable price and smaller form factor. MOTU Ultralite Mk5 ASR Review.

3) MOTU M4 - $250, 4 channel unbalanced/balanced analog output, 4 channel balanced analog input, good analog performance. Good budget option for 2.1/2.2 or 2 way active systems, I/O functionality is rather limited. MOTU M4 ASR Review.

4) Whatever you have on hand! Part of the beauty of a CamillaDSP / RPi4 setup is that a RPi4 is cheap and available and if you want to try it out with another USB DAC it is rather easy to do so. Obviously I will not be able to provide specific configuration files but this tutorial should help you get started.

Although I am not providing configuration files for the following devices, I have used them successfully with CamillaDSP on a RPi4 and can help you with them if needed. In particular the MCHstreamer / USBstreamer are very useful as they allow you to use old pro audio interfaces with ADAT inputs to achieve 8 channels of output at 44.1/48 kHz.

miniDSP MCHstreamer
miniDSP USBstreamer
Focusrite 18i20 2nd gen
DIYINHK multichannel XMOS

Besides this thread what are other good sources of information?

CamillaDSP GitHub
Henrik has done a great job with the GitHub and it is an excellent reference. Almost everything I present here can also be found there.

CamillaDSP DIYAudio Thread
If you want to ask a question about CamillaDSP this is where I would ask it. A good thread to search if you have questions on a particular topic.

Pi4 + CamillaDSP + MOTU M4 ASR Thread
This was the thread that got me started with CamillaDSP. You can also search ASR for Camilla and find a few other useful threads.

Budget Standalone Toslink > DSP > Toslink with CamillaDSP ASR Thread
Great thread by @MarcosCh showing how to make a low cost (< 50€ !) TOSLINK input / output stereo room correction DSP using CamillaDSP.

Using a Raspberry Pi as equaliser in between an USB Source and USB DAC
Great thread from @DeLub on how to use a RPi as a USB gadget. Note if you are using Ubuntu 22.10 or later steps 1-6 can be skipped (no need to compile kernel).
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Part 2: CamillaDSP Setup

This part describes how to get a working CamilllaDSP setup. Values shown in bold are user defined such as desired hostname and/or username for your RPi, everything else is universal and can be copy / pasted as-is. Items entered in code snippets are intended to be entered in terminal unless they are in italics in which case they are meant to be copy / pasted in to the file being edited in nano.

For reference, a complete install should take just under 1 hour (including display, FLIRC IR receiver and USB wifi setup included in Part 4), most of that time is waiting for things to download / install.

1-4) Write Ubuntu Server 64 bit to micro SD card using Raspberry Pi Imager and login via SSH

Download and install Raspberry Pi Imager from the links below for your OS.

Raspberry Pi Imager for Ubuntu
Raspberry Pi Imager for Windows
Raspberry Pi Imager for macOS

A brief note on micro SD cards, I've been using a 32 GB Sandisk Extreme Pro, others have mentioned they have had good experience with 32 GB Sandisk Ultras. I do not think the specific micro SD card is super important but if things seem slow or you have data corruption issues you might try one of the cards mentioned above. I've also had good luck with USB SSDs but prefer SD cards as they keep everything tidier.

Open Raspberry Pi Imager and select your desired OS and micro SD card. At this time I recommend either Ubuntu Server 22.04 LTS 64 bit or Ubuntu Server 23.10 64 bit. 22.04 LTS has the advantage of longer term support / updates but 23.10 comes with a newer kernel (6.5 vs 5.15) which enables USB gadget mode.

Setup your hostname, username, password, SSH and wifi settings and click the Write button to write OS to micro SD card.

Raspberry Pi Imager Settings.png


This install assumes you are managing the RPi remotely via SSH. If you are running Mac or Linux you will have terminal installed by default and can enter the commands shown in subsequent steps in this tutorial in terminal without issue.

If you are running Windows 10 or 11 I recommend you install Windows Subsystem for Linux (WSL). Instruction below are condensed version of this -> https://docs.microsoft.com/en-us/windows/wsl/install.

Open PowerShell as administrator as shown below.

PowerShell.png


Run wsl --install in PowerShell and restart.

wsl install.png


Once you restart open Ubuntu which will give you a terminal to enter commands.

Ubuntu.png


Instead of SSH you can also do the setup by connecting a monitor and keyboard to the RPi but I think being able to configure the RPi remotely is huge asset.

Before we get started a few notes about using copy / paste in terminal and/or nano. On Mac this is very straight forward you can use cmd + v or right click + Paste likely you normally would. On Windows running WSL it is a little weird, I have not found a keyboard shortcut that works but if you right click it will paste what is in your clipboard.

5) Update / upgrade RPi

Open terminal and log in to RPi remotely via SSH.

Rich (BB code):
ssh username@hostname

Rich (BB code):
sudo apt update
sudo apt full-upgrade

Say yes to any prompts asking if you want to upgrade. You may be prompted about restarting services, if so just hit enter.

6) Install CamillaDSP

Make a camilladsp folder as well as folders for CamillaDSP to reference stored coefficients and configurations.

Rich (BB code):
mkdir ~/camilladsp ~/camilladsp/coeffs ~/camilladsp/configs

Install alsa-utils. This will give you access to helpful ALSA tools like aplay and amixer, it will also install libasound2 as a dependency which is required by CamillaDSP and is not initially included in Ubuntu Server 64 bit.

Rich (BB code):
sudo apt install alsa-utils

As of 12/13/2023 I am installing the camilladsp binary in /usr/local/bin/ instead of ~/camilladsp/, this allows camilladsp to be run by just invoking "camilladsp" instead of the full path to camilladsp.

Download and unpack CamillaDSP. The commands below will install V2.0.3 in /usr/local/bin/.

Rich (BB code):
wget https://github.com/HEnquist/camilladsp/releases/download/v2.0.3/camilladsp-linux-aarch64.tar.gz -P ~/camilladsp/
sudo tar -xvf ~/camilladsp/camilladsp-linux-aarch64.tar.gz -C /usr/local/bin/

7) Create CamillaDSP yml configuration file

Assuming you are using one of the DACs listed in Part 1, see Part 3 for configuration files for a variety of use cases. Download the appropriate configuration file from the end of Part 3, for example for a MOTU Ultralite Mk5 streamer setup using a 44 kHz capture rate and a 96 kHz playback rate use "ultralitemk5_streamer_44c_96p_v2_12142023.yml". In Windows open this file up with notepad or wordpad, in Mac use textedit.

Copy the text in the configuration file and use nano to create an yml configuration file on your RPi. Paste the text from your configuration file in to nano and save the yml configuration file. Here is an example of creating a configuration file called ultralitemk5_streamer.yml but you can name the configuration file anything you like, it just needs to end in .yml.

Rich (BB code):
nano ~/camilladsp/configs/ultralitemk5_streamer.yml

As an alternative to using copy / paste in nano you can directly transfer the files to the RPi using scp. To do this you need to be in terminal on your local machine and NOT logged in to the RPi via SSH.

As an example for the Ultralite Mk5:

Rich (BB code):
sudo scp /path/to/configuration/on/local/machine/ultralitemk5_streamer_44c_96p_v2_12142023.yml username@hostname:/home/username/camilladsp/configs/ultralitemk5_streamer.yml

If you have a local copy of the file you are trying to get on the RPi you can use scp as an alternative to copy / pasting in nano anywhere in this tutorial. Many find nano difficult to use while text editors on Mac and PC are in general more user friendly and you have the benefit of a mouse.

As a reference for those using WSL you can navigate to the home directory of your WSL Ubuntu installation by going to \\wsl.localhost\Ubuntu\home in Windows Explorer and drag and drop the files you want to transfer there so they can easily be referenced in WSL.

8) Set up ALSA loopback

If you are using a physical input (AES, TOSLINK, SPDIF, analog) you can skip this step.

An ALSA loopback is a virtual soundcard that has two devices (0 and 1). A software player can be directed to play to Loopback device 1 which will then be rerouted to Loopback device 0, in this case Loopback device 0 now acts as a source that can be used as a CamillaDSP capture device.

By default, ALSA loopback is not installed on Ubuntu Server 64 bit. Run command below to install it.

Rich (BB code):
sudo apt install linux-modules-extra-raspi

Use nano to create snd-aloop.conf.

Rich (BB code):
sudo nano /etc/modules-load.d/snd-aloop.conf

Add line below to snd-aloop.conf and save.

Rich (BB code):
snd-aloop

Reboot RPi.

Rich (BB code):
sudo reboot

Log back in to RPi.

Rich (BB code):
ssh username@hostname

9) Try starting CamillaDSP

We will eventually install a service to automatically start CamillaDSP, but first try to start directly from terminal to make sure everything is working as expected. This example assumes a configuration file called ultralitemk5_streamer.yml, please update to the name of your configuration file.

Rich (BB code):
camilladsp -g-40 -p 1234 ~/camilladsp/configs/ultralitemk5_streamer.yml -v

You should see an output similar to what is shown below in terminal. As we added "-v" there will be a lot of good debugging information that can help you troubleshoot in case of an error. To exit enter crtl + c.

Rich (BB code):
username@hostname:~$ camilladsp -g-40 -p 1234 ~/camilladsp/configs/ultralitemk5_streamer.yml -v
2023-12-15 14:07:07.225478 INFO [src/bin.rs:683] CamillaDSP version 2.0.0
2023-12-15 14:07:07.225541 INFO [src/bin.rs:684] Running on linux, aarch64
2023-12-15 14:07:07.225656 DEBUG [src/bin.rs:728] Loaded state: None
2023-12-15 14:07:07.225678 DEBUG [src/bin.rs:732] Using command line argument for initial volume
2023-12-15 14:07:07.225691 DEBUG [src/bin.rs:755] Using default initial mute
2023-12-15 14:07:07.225702 DEBUG [src/bin.rs:765] Initial mute: [false, false, false, false, false]
2023-12-15 14:07:07.225716 DEBUG [src/bin.rs:766] Initial volume: [-40.0, -40.0, -40.0, -40.0, -40.0]
2023-12-15 14:07:07.225734 DEBUG [src/bin.rs:768] Read config file Some("/home/michael5/camilladsp/configs/ultralitemk5_streamer.yml")
2023-12-15 14:07:07.265438 DEBUG [src/bin.rs:808] Config is valid
2023-12-15 14:07:07.266044 DEBUG [src/socketserver.rs:432] Start websocket server on 127.0.0.1:1234
2023-12-15 14:07:07.266382 DEBUG [src/bin.rs:994] Wait for config
2023-12-15 14:07:07.266410 DEBUG [src/bin.rs:1010] Waiting to receive a command
2023-12-15 14:07:07.266426 DEBUG [src/bin.rs:1013] Config change command received
2023-12-15 14:07:07.266440 DEBUG [src/bin.rs:999] New config is available and there are no queued commands, continuing
2023-12-15 14:07:07.266453 DEBUG [src/bin.rs:1036] Config ready, start processing
2023-12-15 14:07:07.267173 DEBUG [src/bin.rs:157] Using channels [true, true]
2023-12-15 14:07:07.269284 DEBUG [src/filters.rs:488] Build new pipeline
2023-12-15 14:07:07.272542 DEBUG [src/processing.rs:19] build filters, waiting to start processing loop
2023-12-15 14:07:07.383996 DEBUG [src/alsadevice.rs:334] Available Playback devices: [("hw:Loopback,0,0", "Loopback, Loopback PCM, subdevice #0"), ("hw:Loopback,0,1", "Loopback, Loopback PCM, subdevice #1"), ("hw:Loopback,0,2", "Loopback, Loopback PCM, subdevice #2"), ("hw:Loopback,0,3", "Loopback, Loopback PCM, subdevice #3"), ("hw:Loopback,0,4", "Loopback, Loopback PCM, subdevice #4"), ("hw:Loopback,0,5", "Loopback, Loopback PCM, subdevice #5"), ("hw:Loopback,0,6", "Loopback, Loopback PCM, subdevice #6"), ("hw:Loopback,0,7", "Loopback, Loopback PCM, subdevice #7"), ("hw:Loopback,1,0", "Loopback, Loopback PCM, subdevice #0"), ("hw:Loopback,1,1", "Loopback, Loopback PCM, subdevice #1"), ("hw:Loopback,1,2", "Loopback, Loopback PCM, subdevice #2"), ("hw:Loopback,1,3", "Loopback, Loopback PCM, subdevice #3"), ("hw:Loopback,1,4", "Loopback, Loopback PCM, subdevice #4"), ("hw:Loopback,1,5", "Loopback, Loopback PCM, subdevice #5"), ("hw:Loopback,1,6", "Loopback, Loopback PCM, subdevice #6"), ("hw:Loopback,1,7", "Loopback, Loopback PCM, subdevice #7"), ("hw:Headphones,0,0", "bcm2835 Headphones, bcm2835 Headphones, subdevice #0"), ("hw:Headphones,0,1", "bcm2835 Headphones, bcm2835 Headphones, subdevice #1"), ("hw:Headphones,0,2", "bcm2835 Headphones, bcm2835 Headphones, subdevice #2"), ("hw:Headphones,0,3", "bcm2835 Headphones, bcm2835 Headphones, subdevice #3"), ("hw:Headphones,0,4", "bcm2835 Headphones, bcm2835 Headphones, subdevice #4"), ("hw:Headphones,0,5", "bcm2835 Headphones, bcm2835 Headphones, subdevice #5"), ("hw:Headphones,0,6", "bcm2835 Headphones, bcm2835 Headphones, subdevice #6"), ("hw:Headphones,0,7", "bcm2835 Headphones, bcm2835 Headphones, subdevice #7"), ("hw:UltraLitemk5,0,0", "UltraLite-mk5, USB Audio, subdevice #0"), ("null", "Discard all samples (playback) or generate zero samples (capture)"), ("hw:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nDirect hardware device without any conversions"), ("hw:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nDirect hardware device without any conversions"), ("plughw:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nHardware device with all software conversions"), ("plughw:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nHardware device with all software conversions"), ("default:CARD=Loopback", "Loopback, Loopback PCM\nDefault Audio Device"), ("sysdefault:CARD=Loopback", "Loopback, Loopback PCM\nDefault Audio Device"), ("front:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nFront output / input"), ("surround21:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n2.1 Surround output to Front and Subwoofer speakers"), ("surround40:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n4.0 Surround output to Front and Rear speakers"), ("surround41:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n4.1 Surround output to Front, Rear and Subwoofer speakers"), ("surround50:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n5.0 Surround output to Front, Center and Rear speakers"), ("surround51:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n5.1 Surround output to Front, Center, Rear and Subwoofer speakers"), ("surround71:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\n7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"), ("dmix:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nDirect sample mixing device"), ("dmix:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nDirect sample mixing device"), ("hw:CARD=Headphones,DEV=0", "bcm2835 Headphones, bcm2835 Headphones\nDirect hardware device without any conversions"), ("plughw:CARD=Headphones,DEV=0", "bcm2835 Headphones, bcm2835 Headphones\nHardware device with all software conversions"), ("default:CARD=Headphones", "bcm2835 Headphones, bcm2835 Headphones\nDefault Audio Device"), ("sysdefault:CARD=Headphones", "bcm2835 Headphones, bcm2835 Headphones\nDefault Audio Device"), ("dmix:CARD=Headphones,DEV=0", "bcm2835 Headphones, bcm2835 Headphones\nDirect sample mixing device"), ("hw:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nDirect hardware device without any conversions"), ("plughw:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nHardware device with all software conversions"), ("default:CARD=UltraLitemk5", "UltraLite-mk5, USB Audio\nDefault Audio Device"), ("sysdefault:CARD=UltraLitemk5", "UltraLite-mk5, USB Audio\nDefault Audio Device"), ("front:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nFront output / input"), ("surround21:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n2.1 Surround output to Front and Subwoofer speakers"), ("surround40:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n4.0 Surround output to Front and Rear speakers"), ("surround41:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n4.1 Surround output to Front, Rear and Subwoofer speakers"), ("surround50:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n5.0 Surround output to Front, Center and Rear speakers"), ("surround51:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n5.1 Surround output to Front, Center, Rear and Subwoofer speakers"), ("surround71:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\n7.1 Surround output to Front, Center, Side, Rear and Woofer speakers"), ("iec958:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nIEC958 (S/PDIF) Digital Audio Output"), ("dmix:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nDirect sample mixing device")]
2023-12-15 14:07:07.390260 DEBUG [src/alsadevice.rs:352] Playback: supported channels, min: 10, max: 22, list: [10, 18, 22]
2023-12-15 14:07:07.390303 DEBUG [src/alsadevice.rs:353] Playback: setting channels to 10
2023-12-15 14:07:07.390405 DEBUG [src/alsadevice.rs:357] Playback: supported samplerates: Discrete([176400, 192000])
2023-12-15 14:07:07.390417 DEBUG [src/alsadevice.rs:358] Playback: setting rate to 192000
2023-12-15 14:07:07.390491 DEBUG [src/alsadevice.rs:362] Playback: supported sample formats: [S24LE3]
2023-12-15 14:07:07.390510 DEBUG [src/alsadevice.rs:363] Playback: setting format to S24LE3
2023-12-15 14:07:07.390592 DEBUG [src/alsadevice_buffermanager.rs:43] Setting buffer size to 8192 frames
2023-12-15 14:07:07.390643 DEBUG [src/alsadevice_buffermanager.rs:57] Device is using a buffer size of 8192 frames
2023-12-15 14:07:07.390654 DEBUG [src/alsadevice_buffermanager.rs:65] Setting period size to 1024 frames
2023-12-15 14:07:07.394799 DEBUG [src/alsadevice.rs:387] Opening Playback device "hw:UltraLitemk5" with parameters: HwParams { channels: Ok(10), rate: "Ok(192000) Hz", format: Ok(S243LE), access: Ok(RWInterleaved), period_size: "Ok(1024) frames", buffer_size: "Ok(8192) frames" }, SwParams(avail_min: Ok(4096) frames, start_threshold: Ok(1) frames, stop_threshold: Ok(8192) frames)
2023-12-15 14:07:07.394887 DEBUG [src/alsadevice.rs:392] Playback device "hw:UltraLitemk5" successfully opened
2023-12-15 14:07:07.395058 DEBUG [src/bin.rs:265] Playback thread ready to start
2023-12-15 14:07:07.394857 DEBUG [src/alsadevice.rs:334] Available Capture devices: [("hw:Loopback,0,0", "Loopback, Loopback PCM, subdevice #0"), ("hw:Loopback,0,1", "Loopback, Loopback PCM, subdevice #1"), ("hw:Loopback,0,2", "Loopback, Loopback PCM, subdevice #2"), ("hw:Loopback,0,3", "Loopback, Loopback PCM, subdevice #3"), ("hw:Loopback,0,4", "Loopback, Loopback PCM, subdevice #4"), ("hw:Loopback,0,5", "Loopback, Loopback PCM, subdevice #5"), ("hw:Loopback,0,6", "Loopback, Loopback PCM, subdevice #6"), ("hw:Loopback,0,7", "Loopback, Loopback PCM, subdevice #7"), ("hw:Loopback,1,0", "Loopback, Loopback PCM, subdevice #0"), ("hw:Loopback,1,1", "Loopback, Loopback PCM, subdevice #1"), ("hw:Loopback,1,2", "Loopback, Loopback PCM, subdevice #2"), ("hw:Loopback,1,3", "Loopback, Loopback PCM, subdevice #3"), ("hw:Loopback,1,4", "Loopback, Loopback PCM, subdevice #4"), ("hw:Loopback,1,5", "Loopback, Loopback PCM, subdevice #5"), ("hw:Loopback,1,6", "Loopback, Loopback PCM, subdevice #6"), ("hw:Loopback,1,7", "Loopback, Loopback PCM, subdevice #7"), ("hw:UltraLitemk5,0,0", "UltraLite-mk5, USB Audio, subdevice #0"), ("null", "Discard all samples (playback) or generate zero samples (capture)"), ("hw:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nDirect hardware device without any conversions"), ("hw:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nDirect hardware device without any conversions"), ("plughw:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nHardware device with all software conversions"), ("plughw:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nHardware device with all software conversions"), ("default:CARD=Loopback", "Loopback, Loopback PCM\nDefault Audio Device"), ("sysdefault:CARD=Loopback", "Loopback, Loopback PCM\nDefault Audio Device"), ("front:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nFront output / input"), ("dsnoop:CARD=Loopback,DEV=0", "Loopback, Loopback PCM\nDirect sample snooping device"), ("dsnoop:CARD=Loopback,DEV=1", "Loopback, Loopback PCM\nDirect sample snooping device"), ("hw:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nDirect hardware device without any conversions"), ("plughw:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nHardware device with all software conversions"), ("default:CARD=UltraLitemk5", "UltraLite-mk5, USB Audio\nDefault Audio Device"), ("sysdefault:CARD=UltraLitemk5", "UltraLite-mk5, USB Audio\nDefault Audio Device"), ("front:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nFront output / input"), ("dsnoop:CARD=UltraLitemk5,DEV=0", "UltraLite-mk5, USB Audio\nDirect sample snooping device")]
2023-12-15 14:07:07.396101 DEBUG [src/alsadevice.rs:352] Capture: supported channels, min: 1, max: 32, list: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32]
2023-12-15 14:07:07.396129 DEBUG [src/alsadevice.rs:353] Capture: setting channels to 2
2023-12-15 14:07:07.396167 DEBUG [src/alsadevice.rs:357] Capture: supported samplerates: Range(8000, 192000)
2023-12-15 14:07:07.396176 DEBUG [src/alsadevice.rs:358] Capture: setting rate to 44100
2023-12-15 14:07:07.396202 DEBUG [src/alsadevice.rs:362] Capture: supported sample formats: [S16LE, S24LE, S24LE3, S32LE, FLOAT32LE]
2023-12-15 14:07:07.396210 DEBUG [src/alsadevice.rs:363] Capture: setting format to S32LE
2023-12-15 14:07:07.396243 DEBUG [src/alsadevice_buffermanager.rs:43] Setting buffer size to 2048 frames
2023-12-15 14:07:07.396277 DEBUG [src/alsadevice_buffermanager.rs:57] Device is using a buffer size of 2048 frames
2023-12-15 14:07:07.396286 DEBUG [src/alsadevice_buffermanager.rs:65] Setting period size to 256 frames
2023-12-15 14:07:07.396476 DEBUG [src/alsadevice.rs:387] Opening Capture device "hw:Loopback,0" with parameters: HwParams { channels: Ok(2), rate: "Ok(44100) Hz", format: Ok(S32LE), access: Ok(RWInterleaved), period_size: "Ok(256) frames", buffer_size: "Ok(2048) frames" }, SwParams(avail_min: Ok(940) frames, start_threshold: Ok(0) frames, stop_threshold: Ok(2048) frames)
2023-12-15 14:07:07.396531 DEBUG [src/alsadevice.rs:392] Capture device "hw:Loopback,0" successfully opened
2023-12-15 14:07:07.396725 DEBUG [src/bin.rs:275] Capture thread ready to start
2023-12-15 14:07:07.396749 DEBUG [src/bin.rs:278] Both capture and playback ready, release barrier
2023-12-15 14:07:07.396770 DEBUG [src/bin.rs:280] Supervisor loop starts now!
2023-12-15 14:07:07.396792 DEBUG [src/alsadevice.rs:951] Starting playback loop
2023-12-15 14:07:07.396810 DEBUG [src/alsadevice.rs:415] Playback loop uses a buffer of 4096 frames
2023-12-15 14:07:07.396808 DEBUG [src/processing.rs:21] Processing loop starts now!
2023-12-15 14:07:07.396918 DEBUG [src/alsadevice.rs:1037] Starting captureloop
2023-12-15 14:07:07.397451 INFO [src/alsadevice.rs:648] Capture device supports rate adjust
2023-12-15 14:07:07.397475 DEBUG [src/alsadevice.rs:657] Capture loop uses a buffer of 2048 frames
2023-12-15 14:07:07.397524 DEBUG [src/alsadevice.rs:253] Starting capture from state: SND_PCM_STATE_PREPARED, Ready to start
2023-12-15 14:07:07.439499 INFO [src/alsadevice.rs:142] PB: Starting playback from Prepared state
2023-12-15 14:07:07.461259 DEBUG [src/countertimer.rs:240] Number of values changed. New 10, prev 2. Clearing history.
2023-12-15 14:07:07.461344 DEBUG [src/countertimer.rs:240] Number of values changed. New 10, prev 2. Clearing history.
2023-12-15 14:07:08.577701 DEBUG [src/countertimer.rs:42] Pausing processing

10) Create CamillaDSP service

There is a significant change between CamillaDSP V1 and V2 in that V2 no longer uses the active_config.yml symlink. If upgrading to V2 please update your service.

Change the User field to reflect your username, as of V2 this service no longer runs as root. If run as root, CamillaDSP will create a statefile with root as owner and the GUI will NOT be able to modify it, running as a normal user prevents this.

"-s camilladsp/statefile.yml" tells CamillaDSP you are specifying a configuration via the GUI. You must also add "-w" to tell CamillaDSP to wait for a configuration to be applied via web socket if using the GUI.

“-g-40” sets CamillaDSP volume control to -40 dB every time it starts to avoid accidentally playing something really loud after a system restart. If you are NOT using CamillaDSP volume control please delete “-g-40”.

"-p 1234" is only necessary if you are using the GUI.

"-o camilladsp/camilladsp.log" will create a log file that you can view in the GUI for troubleshooting. You can increase the verbosity of this log by adding "-l debug".

Rich (BB code):
sudo nano /lib/systemd/system/camilladsp.service

Rich (BB code):
[Unit]
After=syslog.target
StartLimitIntervalSec=10
StartLimitBurst=10

[Service]
Type=simple
User=username
WorkingDirectory=~
ExecStart=camilladsp -s camilladsp/statefile.yml -w -g-40 -o camilladsp/camilladsp.log -p 1234
Restart=always
RestartSec=1
StandardOutput=journal
StandardError=journal
SyslogIdentifier=camilladsp
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=10

[Install]
WantedBy=multi-user.target

Enable camilladsp service.

Rich (BB code):
sudo systemctl enable camilladsp

Start camilladsp service.

Rich (BB code):
sudo service camilladsp start

11) Install python and dependencies

Rich (BB code):
sudo apt install python3 python3-pip python3-websocket python3-aiohttp python3-jsonschema python3-numpy python3-matplotlib unzip

If you are using Ubuntu Server 22.04 LTS, upgrade pip3. This is not required for Ubuntu Server 23.10.

Rich (BB code):
sudo pip3 install --upgrade pip

12) Install pycamilladsp

Download pycamilladsp and install. If you are using Ubuntu 22.04 LTS use the command below.

Rich (BB code):
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp.git

If using Ubuntu 23.10 add "--break-system-packages" to install packages not contained in the system repository. Note, adding "--break-system-packages" will cause the installation to fail if used on Ubuntu 22.04 LTS.

Rich (BB code):
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp.git --break-system-packages

13) Install pycamilladsp-plot

Download pyamilladsp-plot and install. If you are using Ubuntu 22.04 LTS use the command below.

Rich (BB code):
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp-plot.git

If using Ubuntu 23.10 add "--break-system-packages" to install packages not contained in the system repository. Note, adding "--break-system-packages" will cause the installation to fail if used on Ubuntu 22.04 LTS.

Rich (BB code):
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp-plot.git --break-system-packages

14) Install GUI server

Commands below will install V2.1.0 of the GUI.

Rich (BB code):
wget https://github.com/HEnquist/camillagui-backend/releases/download/v2.1.0/camillagui.zip -P ~/camilladsp/
unzip ~/camilladsp/camillagui.zip -d ~/camilladsp/camillagui

15) Try starting GUI

As with CamillaDSP itself it is good practice to start the GUI directly from terminal before proceeding to creating service.

Rich (BB code):
python3 ~/camilladsp/camillagui/main.py

If all goes well you will see the following output. GUI is accessed via http://hostname:5005 from any web browser on your network. Note V1 used port 5000 and v2 now uses port 5005.

Again, use crtl + c to exit.

Rich (BB code):
username@hostname:~$ python3 ~/camilladsp/camillagui/main.py
======== Running on http://0.0.0.0:5005 ========
(Press CTRL+C to quit)

16) Create service to start GUI

Rich (BB code):
sudo nano /lib/systemd/system/camillagui.service

Update the User field to reflect your username.

Rich (BB code):
[Unit]
Description=CamillaDSP Backend and GUI
After=multi-user.target

[Service]
Type=idle
User=username
WorkingDirectory=~
ExecStart=python3 camilladsp/camillagui/main.py

[Install]
WantedBy=multi-user.target

Enable camillagui service.

Rich (BB code):
sudo systemctl enable camillagui

Start camillagui service.

Rich (BB code):
sudo service camillagui start

17) Assign active configuration in GUI

On a computer that is on the same network as your RPi navigate your browser to http://hostname:5005.

Navigate to Files tab of GUI and set your desired configuration as active by pressing the "star" next to the configuration you want. From now on CamillaDSP and the GUI will start with this configuration loaded. Click the "Apply and Save" button in the lower left to load the configuration to DSP.

Screenshot 2023-12-15 083736.png


Congratulations, you now have CamillaDSP up and running!

If you would like to upgrade to a new version of CamillaDSP simply remove your old CamillaDSP binary and tar and download and extract a new one.

Code:
rm ~/camilladsp/camilladsp ~/camilladsp/camilladsp-linux-aarch64.tar.gz
wget https://github.com/HEnquist/camilladsp/releases/download/v2.0.3/camilladsp-linux-aarch64.tar.gz -P ~/camilladsp/
sudo tar -xvf ~/camilladsp/camilladsp-linux-aarch64.tar.gz -C /usr/local/bin/
sudo service camilladsp restart

Upgrading the GUI is a similar process.

Code:
rm -r ~/camilladsp/camillagui ~/camilladsp/camillagui.zip
wget https://github.com/HEnquist/camillagui-backend/releases/download/v2.1.0/camillagui.zip -P ~/camilladsp/
unzip ~/camilladsp/camillagui.zip -d ~/camilladsp/camillagui
sudo service camilladsp restart
sudo service camillagui restart

For upgrades to pycamilladsp and pycamilladsp-plot, re-run the original install commands to get the new versions. For example, running the following will give the most recent versions on Ubuntu 22.04 LTS.

Code:
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp.git
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp-plot.git
sudo service camillagui restart

For upgrades on Ubuntu 23.10 you need to add "--break-system-packages".

Code:
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp.git --break-system-packages
sudo pip3 install git+https://github.com/HEnquist/pycamilladsp-plot.git --break-system-packages
sudo service camillagui restart
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Part 3: CamillaDSP Configurations

There are two basic ways to use CamillaDSP, one is to use RPi as a streamer (AirPlay, squeezelite, spotify, bluetooth, etc) and other is to use an external physical input like TOSLINK, SPDIF, AES or analog. I will document configuration files for both streamer and external inputs for each of the recommended DACs in this tutorial. The configurations are simple and route 2 channel input to all available outputs.

For streamer applications I am assuming your player is outputting 44.1 kHz and resampling everything that is not 44.1 kHz to accomplish this. Before we get started I will show you how to install shairport-sync (Airplay) and squeezelite as these are the players that I use in my streamer setup and how to best configure them.

Install shairport-sync

From here on out and I am going to assume you know how to SSH in to your RPi so you won’t see that step.

Rich (BB code):
sudo apt install shairport-sync libsoxr-dev

After you install there are some configuration items we will need to change.

Rich (BB code):
sudo nano /etc/shairport-sync.conf

Uncomment the following lines (delete // from start of line) and make changes shown below.

Rich (BB code):
interpolation = "soxr";
output_device = "hw:Loopback,1";

Using SOX for interpolation should avoid audible artifacts from clock syncing. The last line sets the output device to your ALSA loopback device 1. Airplay will automatically resample to 44.1 kHz sample rate by default.

Restart shairport-sync service to reflect changes in shairport-sync.conf

Rich (BB code):
sudo service shairport-sync restart

Install squeezelite

Rich (BB code):
sudo apt install squeezelite

Like shairport-sync we need to make a few changes to the squeezelite configuration. Copy and paste the lines shown below to the end of the file using nano.

Rich (BB code):
sudo nano /etc/default/squeezelite

Rich (BB code):
SL_SOUNDCARD="hw:Loopback,1"
SB_EXTRA_ARGS="-W -C 5 -r 44100-44100 -R hLE:::28"

Restart squeezelite service to reflect changes.

Rich (BB code):
sudo service squeezelite restart

These changes set your ALSA loopback device 1 as squeezelite playback device, resample all files to 44.1 kHz using a high quality resampling algorithm and stop squeezelite after 5 seconds of inactivity.

I've had a few requests for a bluetooth input, see below for instructions on how to setup bluez-alsa to accomplish this. I have not tested this extensively but it seems to work fine. As my iPhone doesn't support the more advanced codecs like LDAC or apt-X this setup uses the default SBC codec.

Install bluez-alsa

First install blue-alsa-utils.

Rich (BB code):
sudo apt install bluez-alsa-utils

Modify bluealsa service to use a2dp-sink profile.

Rich (BB code):
sudo nano /lib/systemd/system/bluez-alsa.service

Add bolded text to "ExecStart".

Rich (BB code):
ExecStart=/usr/bin/bluealsa $OPTIONS -p a2dp-sink

Reboot RPi.

Rich (BB code):
sudo reboot

Run bluetoothctl to pair your device.

Rich (BB code):
bluetoothctl

Once you are in bluetoothctl setup pairing agent and make RPi discoverable.

Rich (BB code):
default-agent
discoverable on

Pair your device and say yes to all prompts.

Make your device trusted so that the RPi will accept connections in the future and exit bluetoothctl. XX:XX:XX:XX:XX:XX is the MAC address of your device, when you pair your device you should see this listed in the bluetoothctl output.

Rich (BB code):
trust XX:XX:XX:XX:XX:XX
exit

Setup service to run bluealsa-aplay playing to the ALSA loopback. You will need to change "ExecStart" line to reflect your device MAC address.

Rich (BB code):
sudo nano /lib/systemd/system/bluealsa-aplay.service

Rich (BB code):
[Unit]
After=syslog.target
StartLimitIntervalSec=10
StartLimitBurst=10

[Service]
Type=simple
ExecStart=bluealsa-aplay XX:XX:XX:XX:XX:XX -D plughw:Loopback,1
Restart=always
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=bluealsa-aplay
User=root
Group=root

[Install]
WantedBy=multi-user.target

Enable service and reboot RPi.

Rich (BB code):
sudo systemctl enable bluealsa-aplay
sudo reboot

OK, time to jump in to the configuration files.

All configurations use maximum amount of output channels for a given device. If you do not need an output channel remove it from the mixer as each extra channel requires additional processing resource. Configuration files are attached to this post in zip files.

The naming convention for my configuration files is dac_input_capturerate_playbackrate_cdspversion_datelastupdated. For example a CamillaDSP V2 configuration file for a MOTU Ultralite Mk5, TOSLINK input with 96 kHz capture and 96 kHz playback rates is ultralitemk5_toslink_96c_96p_v2_12142023.yml.

CamillaDSP expects a constant capture sample rate and cannot accommodate rate changes without a restart. If you have a variable sample rate physical digital source like TOSLINK, AES or SPDIF or have multiple physical digital sources with different rates a good option is to add a device that has an ASRC to convert to a consistent rate. Some devices with this capability are summarized below.

miniDSP nanoDIGI - $170, discontinued in 2021 but possible to find used, SPDIF / TOSLINK input, SPDIF output, 96 kHz
miniDSP 2x4HD - $225, TOSLINK / analog input, USB output, 96 kHz
miniDSP OpenDRC-DI - $325, AES / SPDIF / TOSLINK input and output, 48 or 96 kHz
miniDSP Flex Digital - $500, SPDIF / TOSLINK / USB / analog / bluetooth input, SPDIF / TOSLINK / USB output, 96 kHz
miniDSP Flex Analog $500-600, SPDIF / TOSLINK / analog / bluetooth input, USB Output, 96 kHz
SHD Studio - $900, AES / SPDIF / TOSLINK / USB / streamer input, SPDIF / AES / USB output, 96 kHz
SHD - $1250, AES / SPDIF / TOSLINK / USB / streamer / analog input, SPDIF / AES / USB output, 96 kHz

All of these devices can do IR volume control, although not all have displays for volume / input identification.

For 2x4HD and Flex you can also use Dirac upgraded versions but sample rate will change from 96 kHz to 48 kHz.

In order to use USB output of devices like 2x4HD, Flex and SHD you need to set them as the CamillaDSP capture device. Unfortunately this ties up the USB input and makes it unusable. Still, this is a good approach to add extra input functionality to basic USB DACs like the MOTU M4 or Topping DM7 which only have USB input.

If you have a constant sample rate digital source the following devices work well. Compared to other solutions like the HiFiBerry Digi+ I/O they handle signal interruptions gracefully. These devices are used in a similar way to the miniDSPs with USB outputs, the device is set as the CamillaDSP capture device. Note that although the S2 digi also has a TOSLINK output I have found that it does not work well if both the TOSLINK input and output are used with CamillaDSP.

hifime S2 digi (SA9227) - $40, TOSLINK input, USB output, sample rates up to 192 kHz
hifime UR23 - $25, TOSLINK input, USB output, sample rates up to 96 kHz

Okto dac8 PRO

These configurations assume that you are NOT using CamillaDSP volume control as the Okto has a nice volume display with knob and IR control. As volume control is downstream of CamillaDSP, digital clipping in CamillaDSP is more of an issue. As a result I have added 1 dB attenuation on all output channels to help avoid clipping, in general if you add boost in your configuration you will want to offset that boost by attenuating the output further. Use the CamillaDSP clipping indicator to gauge if you have enough attenuation to avoid digital clipping.

okto_streamer.yml

Set Okto to “Pure USB” mode. As mentioned previously all streamer configurations expect 44.1 kHz input. As the ALSA loopback has a different clock from the Okto these configurations have rate adjust enabled to allow CamillaDSP to adjust the ALSA loopback to match the Okto clock and avoid buffer under/over runs, you will see this approach in all further streamer configurations. I have also included configurations that upsample to 96 kHz and 192 kHz.

okto_aes.yml

Set Okto to “USB / AES” mode. This configuration assumes you are using 2 channel input with 8 channel output. If you would like to use more input channels you can modify the mixer to do so. No rate adjust is enabled as the Okto is clocked by AES input in this mode. All configurations use the same input and output sample rate as it is not possible to use different sample rates. Configurations are provided for 48, 96 and 192 kHz sample rates.

MOTU Ultralite Mk5

This DAC requires a small amount of setup while connected to a Mac or Windows computer prior to use with CamillaDSP. Install Cuemix 5 and set up channel routing such that USB 1-2 are routed to analog output 1-2, USB 3-4 to analog output 3-4, etc. Make sure no other channel routing is in place as we will do all channel routing in CamillaDSP. Check your levels in the Output tab as my Ultralite Mk5 came with all channels set to -20 dB by default. If you want to use the Mk5 volume knob then select which analog channels (knob will only work on analog channels) you want controlled by the knob in the Output tab. See screenshots below for what this should look like.

CueMix Main 1-2.png
CueMix Main 3-4.png
CueMix Output.png


It is a good idea to update the firmware at this time. After you do this initial setup in Cuemix you will not need to use it again in the future unless you want to upgrade the firmware.

Input / output channels are described below, however not all channels are present at all sample rates. At 44.1/48 kHz all channels are available, at 88.2/96 kHz only inputs 0-15 and outputs 0-17 are available and at 176.4/192 kHz only inputs 0-9 and outputs 0-9 are available.

Inputs:
0-7: analog 1-8
8-9: loopback 1-2
10-11: SPDIF 1-2
12-13: TOSLINK/ADAT 1-2
14-15: ADAT 3-4
16-17: ADAT 5-6
18-19: ADAT 7-8

Outputs:
0-9: analog 1-10
10-11: headphone 1-2
12-13: SPDIF 1-2
14-15: TOSLINK/ADAT 1-2
16-17: ADAT 3-4
18-19: ADAT 5-6
20-21: ADAT 7-8

Once you have channel routing setup in Cuemix this DAC is very similar to the Okto in terms of setup just with more inputs / output options. Although it has a volume knob, I like to use CamillaDSP for volume control with the Mk5 as it does not have an IR receiver. I use a FLIRC USB IR receiver and separate display for volume indication as described in Part 4.

ultralitemk5_streamer.yml

Set clock source to internal via Ultralite Mk5 front panel. All streamer configurations expect 44.1 kHz input. As the ALSA loopback has a different clock from the Ultralite Mk5 these configurations have rate adjust enabled to allow CamillaDSP to adjust the ALSA loopback to match the Ultralite Mk5 clock and avoid buffer under/over runs. I have also included configurations that upsample to 96 kHz and 192 kHz.

ultralitemk5_toslink.yml

Set clock source to optical and change optical input setting to TOSLINK via Ultralite Mk5 front panel. No rate adjust is enabled as the Ultralite Mk5 is clocked by TOSLINK input in this mode. All configurations use the same input and output sample rate as it is not possible to use different sample rates. Configurations are provided for 48 and 96 kHz sample rates, note that at 176.4/192 kHz optical and SPDIF I/O are disabled.

ultralitemk5_spdif.yml

Set clock source to SPDIF via Ultralite Mk5 front panel. No rate adjust is enabled as the Ultralite Mk5 is clocked by SPDIF input in this mode. All configurations use the same input and output sample rate as it is not possible to use different sample rates. Configurations are provided for 48 and 96 kHz sample rates, note that at 176/192 kHz optical and SPDIF I/O are disabled.

ultralitemk5_analog.yml

Set the clock source to internal via Ultralite Mk5 front panel. This configuration uses analog 3 and 4 as inputs but you can add/change to other inputs as needed. All configurations use the same input and output sample rate as it is not possible to use different sample rates. Configurations are provided for 48, 96 and 192 kHz sample rates.

MOTU M4

This is the easiest of the bunch to setup as it has limited I/O functionality. Like the Ultralite Mk5 I use CamillaDSP volume control with this DAC.

m4_streamer.yml

All streamer configurations expect 44.1 kHz input. As the ALSA loopback has a different clock from the M4 these configurations have rate adjust enabled to allow CamillaDSP to adjust the ALSA loopback to match the M4 clock and avoid buffer under/over runs. I have also included configurations that upsample to 96 kHz and 192 kHz.

m4_analog.yml

This configuration uses analog inputs 3 and 4 but you can use others if needed. All configurations use the same input and output sample rate as it is not possible to use different sample rates. Configurations are provided for 48, 96 and 192 kHz sample rates.

m4_2x4hd.yml

This configuration uses a miniDSP 2x4HD as capture device. Rate adjust and asynchronous resampling are enabled to prevent buffer under/over runs as the 2x4HD and M4 have separate clocks and unlike an ALSA Loopback CamillaDSP has no ability to adjust the 2x4HD clock. Capture sample rate is set to 96 kHz to match the miniDSP 2x4HD sample rate. Only a 96 kHz playback sample rate configuration is provided but this can be changed to any sample rate supported by the M4 as the capture and playback devices are separate.

m4_sa9227.yml

This configuration uses a hifime S2 digi (SA9227) as capture device. Rate adjust and asynchronous resampling are enabled to prevent buffer under/over runs as the S2 digi (SA9227) and M4 have separate clocks and unlike an ALSA Loopback CamillaDSP has no ability to adjust the S2 digi (SA9227) clock. Capture sample rate is set to device maximum of 96 kHz but this can also be set to lower rates to match your source. Configurations are provided with 96 kHz and 192 kHz playback sample rates.

m4_ur23.yml

This configuration uses a hifime UR23 as capture device. Rate adjust and asynchronous resampling are enabled to prevent buffer under/over runs as the UR23 and M4 have separate clocks and unlike an ALSA Loopback CamillaDSP has no ability to adjust the UR23 clock. Configurations are provided for 44.1 kHz and 192 kHz capture sample rates but this can be changed to match your source. Both provided configurations use a 192 kHz playback sample rate but this can be changed as desired as capture and playback devices are separate.
 

Attachments

  • okto_configs.zip
    8.7 KB · Views: 91
  • ultralitemk5_configs.zip
    14 KB · Views: 119
  • m4_configs.zip
    13.6 KB · Views: 112
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Part 4: Advanced Configuration

Using the GUI

As mentioned previously you can view the GUI by going to any browser on your network and entering http://hostname:5005.

As of V2 the first tab the Title tab. There isn't much to do in this tab but you can populate Title and Description fields for your configuration. The Title field is displayed on the first line of the OLED display described later in this tutorial.

Title.png


The Devices tab defines general parameters like capture device, playback device, sample rate, rate adjust, resampling and chunk size.

It is very important that sample format and channel count are supported by your device. If you are using my configurations this will not be an issue but if you are trying to use a different device it is something to be aware of. The majority of issues I see with CamillaDSP not starting are the result of incorrectly specified channel counts and/or formats.

Devices.png


In the Filters tab you can add any filter you want. A big advantage of using the GUI over a manual configuration file is that it will prompt you for the necessary information for the filter type you are using. Once you have created a filter you can view the magnitude / phase / group delay and make sure it matches your expectation. If you have questions about specific filter implementation see the CamillaDSP GitHub. Creating a filter in the Filters tab does not apply it to the pipeline, it just creates a filter that will be available for you to apply in the pipeline.

Filters.png


The Mixers tab defines channel routing, in addition you can change gain and polarity of each channel. Like filters your mixer will not be in effect until you apply it in the pipeline.

As in the Devices tab it is very important that the channel counts in the Mixers tab exactly match the channel counts of your device. Again if you use my configurations this will not be an issue but it is something to be aware of if you are using a different device. You do not need to use all channels in your mixer but they need to specified in the "in" and "out" section. For example in the screenshot below 8 input and 8 output channels are specified although only 2 input channels (0 and 1) are used in the mixer definition.

Mixers.png


Another new addition with V2 is the Processors tab. I haven't used this personally, but you can use it to implement a compressor.

Processors.png


The Pipeline tab is where everything comes together, this is where you apply filters, mixers and processors created in the previous tabs. You can plot the entire pipeline to show how the mixer and filters are applied as well as the combined magnitude / phase / group delay on each channel.

Pipeline.png

Pipeline Map.png


The Files tab stores configurations and convolution filters. It will show configuration files located in ~/camilladsp/configs/ and convolution filters located in ~/camilladsp/coeffs/. You can download/upload configurations and convolution filters to/from your local computer. You can also save the configuration currently loaded in the GUI to either a new configuration file or an existing one.

To load a configuration in the GUI press the clockwise arrow button next to your desired configuration. Once this is done you will see the configuration name appear in the lower left under "Config", in the screenshot below you can see that a configuration called lxminibsc.yml is loaded in the GUI.

Just because a configuration is loaded in the GUI does NOT mean it is actually applied to the DSP. To apply a configuration to the DSP click the "Apply to DSP" button. This will apply the configuration in the GUI to the DSP but it will NOT save any changes made via the GUI. If you would like to save changes click the "Save to File" button. If you would like both of these operations done at the same time you can click the "Apply and save" button. Alternatively you can use the "Apply automatically" and "Save automatically" check boxes to do these operations automatically after a change is made in the GUI.

If you have a question about what settings are currently applied to the DSP click the "Fetch from DSP" button and it will load the GUI with the current DSP settings. Note it only pulls the settings and does NOT change the configuration name in the lower left.

In order to set a configuration as default (i.e. the configuration that will be loaded when CamillaDSP starts) click the star button next to your desired configuration. After you do this the star button will now be green next to your default configuration.

Files.png


There is a nice compact view that is great for changing volume or configurations from a smartphone or tablet. You can access it by clicking the "Change to compact view" button just to the right of the CamillaDSP logo.

If you add filters named "Bass" and "Treble" you can use the sliders in this view as bass / treble tone controls to control the boost / cut of those filters. Recommended parameters for bass and treble tone control are lowshelf, f=85 Hz, q=0.9 and highshelf, f=6500 Hz, q=0.7 respectively.

IMG_8873.PNG


This is where things get fun! When looking at these options you will notice the Okto has a lot of really nice features that are not available on the other DACs such IR volume control, a big volume display and trigger output. Wouldn’t it be great if we could get the same functionality on other DACs? Turns out you can do this relatively easily.

FLIRC USB IR Receiver

A FLIRC IR receiver is an easy way to add IR volume control for around $20. I’ve created a python script so setting this up is very easy. The first step is to download the FLIRC software on your main computer and connect the FLIRC receiver to that computer. Use the software to pair your remote so that volume up is KEY UP, volume down is KEY DOWN, mute is KEY LEFT and source change is KEY RIGHT.

Pressing KEY LEFT will cause CamillaDSP to mute, if you switch configurations this mute will stay set. You can change volume up and down while muted, the mute will only be removed by either pressing KEY LEFT again or unmuting in the GUI.

Install evdev.

Rich (BB code):
sudo apt install python3-evdev

Copy / paste python the FLIRC python script attached to this post to ~/flirc.py using nano.

Rich (BB code):
nano ~/flirc.py

As of 12/13/2023, configuration switching in flirc.py has been changed to accommodate CamillaDSP V2. To identify which configurations you would like to switch between, add a "_" in front of the configuration file. For example, if you had a configurations titled _ultralitemk5_toslink48.yml, _ultralitemk5_streamer.yml, _ultralitemk5_analog.yml and ultralitemk5_streamer.yml, pressing KEY RIGHT would switch between _ultralitemk5_toslink48.yml, _ultralitemk5_streamer.yml and _ultralitemk5_analog.yml but NOT ultralitemk5_streamer.yml because it does not start with "_".

Enable USB-C port for use, this is needed to run the IR receiver from the USB-C port (you will see why you might want to do this in the section discussing cases). If you have the FLIRC plugged in to a USB-A port this is not needed.

Rich (BB code):
sudo nano /boot/firmware/config.txt

In the section starting with "# Config settings specific to arm64" add ,dr_mode=host after dtoverlay=dwc2 such that it looks like the line below. Reboot for the changes to take effect.

Rich (BB code):
# Config settings specific to arm64
arm_64bit=1
dtoverlay=dwc2,dr_mode=host

Check that your FLIRC is recognized. Run lsusb and make sure you see an entry for Clay Logic flirc as shown below.

Rich (BB code):
lsusb

Rich (BB code):
username@hostname:~$ lsusb
Bus 003 Device 002: ID 20a0:0006 Clay Logic flirc
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 07fd:000c Mark of the Unicorn UltraLite-mk5
Bus 001 Device 005: ID 07fd:0008 Mark of the Unicorn M Series
Bus 001 Device 004: ID 262a:10e7 SAVITECH Corp. UR23 USB SPDIF Rx
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Next check that the FLIRC device is named what we expect.

Rich (BB code):
ls /dev/input/by-id/

Expected output is:

Rich (BB code):
username@hostname:~$ ls /dev/input/by-id/
usb-flirc.tv_flirc-if01-event-kbd

If you see something different, potentially like usb-flirc.tv_flirc_E7A648F650554C39322E3120FF08122E-if01-event-kbd you will need to modify flirc.py to reflect this.

Rich (BB code):
nano ~/flirc.py

If needed change the flirc=evdev.InputDevice line near the top to reflect your FLIRC name.

Rich (BB code):
flirc=evdev.InputDevice('/dev/input/by-id/usb-flirc.tv_flirc-if01-event-kbd')

Create service to start FLIRC python script. Change User field to reflect your username.

Rich (BB code):
sudo nano /lib/systemd/system/flirc.service

Rich (BB code):
[Unit]
After=syslog.target
StartLimitIntervalSec=10
StartLimitBurst=10

[Service]
Type=simple
User=username
WorkingDirectory=~
ExecStart=python3 flirc.py
Restart=always
RestartSec=1
StandardOutput=journal
StandardError=journal
SyslogIdentifier=flirc

[Install]
WantedBy=multi-user.target

Enable FLIRC service.

Rich (BB code):
sudo systemctl enable flirc

Start FLIRC service.

Rich (BB code):
sudo service flirc start

Trigger Output

It is easy to add a trigger output to the Ultralite Mk5 using a Bobwire DAT1. Simply connect the TOSLINK output of the Ultralite Mk5 to the Bobwire DAT1 and use the Audio Detect output port. All of my configuration files are set to stop after 5 seconds of output less than -100 dB, as a result CamillaDSP will stop after 5 seconds and after 60 seconds the trigger from the Bobwire DAT1 will stop and your amplifiers will turn off. Once CamillaDSP starts playing the Bobwire DAT1 trigger will fire up immediately. The only issues I have with the Bobwire DAT1 are that it is relatively expensive (~$70) and for me the provided power supply had a high frequency noise coming from the power supply itself, I swapped this out with another generic 12 V power supply and the noise went away.

OLED Display

RPis have GPIO pins which can be used to interface with a variety of displays. I’ve developed a python script that works with the buydisplay.com 3.2” diagonal SSD1322 OLED display which is around ~$30 + shipping. Be sure to order the display in the 6800 8 bit configuration, I also recommend you have them solder a pin header as it is only an additional cost of $0.59.

I should warn that my code is messy and will make actual programmers cringe but it works well and it is decently easy to modify. The base setup turns the display off after 10 seconds of no volume changes to avoid OLED burn in. It will turn back on if you change the volume or the CamillaDSP status or configuration changes.

As of 02/21/2023 there are now two options for the oled python script, one based on lgpio and one based on rpi-gpio. @LandscapeJohn did some testing as noted here and found that rpi-gpio was significantly faster than the lgpio. This makes a considerable difference in the responsiveness of the display. I originally chose lgpio over rpi-gpio as I had read that rpi-gpio support was going away (see here and here). However, as of Ubuntu 23.10 rpi-gpio still works and it is well worth using for the significant performance increase. @LandscapeJohn also made some slight changes to the way the routine sends data / commands to the display which I implemented in the lgpio version as well for a slight performance increase.

Note, RPi5s do NOT support rpi-gpio and need to use lgpio, in addition you need to change the line "chip = sbc.gpiochip_open(0)" to "chip = sbc.gpiochip_open(4)".

The python script has the ability to show user defined text on the first line of the display based on loaded configuration file. With CamillaDSP V2, this will show the Title field under the Title tab of the GUI. If this field is blank, "CamillaDSP" will be displayed.

If using lgpio based routine install lgpio.

Rich (BB code):
sudo apt install python3-lgpio

If using rpi-gpio routine (recommended) install rpi-gpio.

Rich (BB code):
sudo apt install python3-rpi.gpio

Copy / paste python script in attached “oled.py” in to ~/oled.py using nano.

Rich (BB code):
nano ~/oled.py

Create service to start OLED python script.

Rich (BB code):
sudo nano /lib/systemd/system/oled.service

If using Ubuntu 22.04 LTS, use the service below and change User field to reflect your username.

Rich (BB code):
[Unit]
After=syslog.target
StartLimitIntervalSec=10
StartLimitBurst=10

[Service]
Type=simple
User=username
WorkingDirectory=~
ExecStart=python3 oled.py
Restart=always
RestartSec=1
StandardOutput=journal
StandardError=journal
SyslogIdentifier=oled

[Install]
WantedBy=multi-user.target

If using Ubuntu 23.10, use the service below and change the username in the WorkingDirectory field to reflect your username. A different service is required for Ubuntu 23.10 as it requires oled.py to be run as root.

Code:
[Unit]
After=syslog.target
StartLimitIntervalSec=10
StartLimitBurst=10

[Service]
Type=simple
WorkingDirectory=/home/username/
ExecStart=python3 oled.py
Restart=always
RestartSec=1
StandardOutput=journal
StandardError=journal
SyslogIdentifier=oled
User=root
Group=root

[Install]
WantedBy=multi-user.target

Enable OLED service.

Rich (BB code):
sudo systemctl enable oled

Start OLED service.

Rich (BB code):
sudo service oled start

Wiring configuration from the display to the RPi GPIO header is listed below. Note, these pins can be changed as desired, see here for more information on RPi4 pinout -> https://www.tomshardware.com/reviews/raspberry-pi-gpio-pinout,6122.html. Specifically using GPIO 18 for the display may be an issue if you are using the display with a DAC HAT.

01 (ground) -> ground
02 (supply voltage) -> 3.3 V
03 (no connection) -> no connection
04 (data bus 0) -> GPIO 26
05 (data bus 1) -> GPIO 13
06 (data bus 2) -> GPIO 6
07 (data bus 3) -> GPIO 5
08 (data bus 4) -> GPIO 22
09 (data bus 5) -> GPIO 27
10 (data bus 6) -> GPIO 17
11 (data bus 7) -> GPIO 18
12 (enable) -> GPIO 23
13 (read/write) -> ground
14 (data/command) -> GPIO 16
15 (reset) -> GPIO 12
16 (chip select)-> GPIO 25

For wiring I used prefabbed 8” long 0.1” header jumpers. These are a bit long but allow you to remove the front panel with the wiring remaining connected which is a nice feature.

Modushop Case

Modushop offers CNC machining of aluminum cases for custom projects. You provide the CAD files and they do the machining. I have found ordering directly from Modushop is slightly cheaper than ordering from DIYAudio Store which is the US distributor, this may change as exchange rates and shipping costs change so be sure to check before ordering. All cases are based on the Galaxy GX247 chassis (230 mm x 170 mm x 40 mm) with 2 mm aluminum covers. I dislike the 1 mm steel covers as they are rather flimsy.

Case designs discussed below are designed to be used with a display and IR receiver. Drawings in dwg, pdf and vsdx format are attached in a zip file.

A challenge with these cases was how to get a USB port in the front of the case for the IR receiver and how to get a power connection in the rear of the case. The only USB port that is accessible from inside the case is the USB-C port which is typically used for power, however this port can be used as a normal USB port and the RPi can be powered via the pin header. Therefore I use a USB-A socket to USB-C plug adapter on the USB-C port coupled with a panel mount USB-A extension cable to connect to the IR receiver at the front of the case. For power I installed a 5.5 mm x 2.1 mm jack in the rear of the case and soldered 20 awg wire with pin connectors at the end to the jack. In my case I used two wires for 5 V and two wires for ground and connected all four wires to the pin header. The double wiring is likely overkill but I wanted to make sure I avoided under voltage issues. I recommend using at least 20 awg here for the same reason. This is the only part of the project that requires soldering, if you are totally against soldering you can purchase a 5.5 mm x 2.1 mm jack with prefabbed wiring and crimp prefabbed 20 awg 0.1” header wiring on the ends. If you do this you will likely need to change the diameter of the power jack hole in the rear case, most the prefabbed options I have seen require a larger diameter than 8 mm so it would be easy for you to drill out the hole yourself to accommodate the larger diameter or you can modify the drawings and have Modushop drill a larger hole.

For a power supply you can either use a standard RPi4 power supply with a USB-C to 5.5 mm adapter or another 5V power supply with the appropriate 5.5 mm jack. Your power supply should be at leas 3 A. I have found that RPi4 power supplies work best as they provide a bit more than 5 V to help tolerate voltage sag.

10 mm front panel - single sided machining - 50€ add-on

This option machines a 10 mm aluminum panel from the back side only. The screen is set half way through the panel thickness and there is a hole for the FLIRC IR receiver, mounting holes for the screen and IR receiver are tapped for M2.5 screws so there are no exposed fasteners. Pictures of this panel are shown below. Overall this option looks very nice, one complaint is that due to the thickness of the front panel the top of the display text can be obstructed from view if you are sitting very near to the case and looking down on the screen. If that bothers you it is possible to modify the layout of the text so that it is more centered on the screen or you can look at my option which chamfers the screen opening from the front side at an additional cost.

Recommended hardware:
display mounting screws: M2.5 x 3 mm long
FLIRC mounting screws: M2.5 x 16 mm long w/ 8 mm spacers
USB-C male to USB-A female: Adafruit USB A Socket to USB Type C Plug Adapter
USB panel extension: Adafruit Panel Mount USB Cable - A Male to A Female

IMG_7444.jpeg

IMG_7437.jpeg

IMG_7442.jpeg


10 mm front panel - double sided machining - 70€ add-on

This is the same as the first option but has a 45 deg chamfer around the screen opening to improve viewing angles.

Recommend hardware: same as single sided 10 mm front panel

IMG_7443.jpeg


3 mm front panel - 31€ add-on

This option uses all through holes so the machining cost is lower, it does require you to purchase a separate 3 mm front panel. It may be possible to swap out the default 10 mm front panel for a 3 mm front panel at reduced cost. This design has a lot of exposed fasteners due to the through holes but has no issues with viewing angle due to the thinner panel. The IR receiver holes are slightly larger than the display holes so that they can accept M3 screws which match the threading of the Adafruit USB panel extension cable, alternatively you can use M2.5 screw with nuts to keep the hardware consistent.

Recommended hardware:
display mounting screws: M2.5 x 12 mm long
FLIRC mounting screws: M2.5 x 30 mm long w/ 15 mm spacers
nuts: M2.5
USB-C male to USB-A female: Adafruit USB A Socket to USB Type C Plug Adapter
USB panel extension: Adafruit Panel Mount USB Cable - A Male to A Female

IMG_7434.jpeg

IMG_7387.jpeg


2 mm bottom panel - 30€ add-on

I recommend paying the 5€ for a solid aluminum bottom panel as in my experience the venting gets in the way of the mounting holes. However the additional 25€ machining cost for 4 RPi4 mounting holes is probably not worth it if you can drill 4 decently accurate holes yourself.

Recommended hardware:
RPi4 mounting screws: M2.5 x 16 mm long w/ 10 mm spacers
nuts: M2.5 (as an alternative you can use the top part of aluminum heatsink case which is tapped for M2.5 screws, this is what I used).

IMG_7440.jpeg


2 mm back panel - 25€ add-on

This is another area where you may be able to save money. For example you could leave the back panel completely off to save on machining costs. I’ve drilled / hand filed similar panels myself which is not fun but certainly can be done at home and the rear will likely not be exposed. This panel has cutouts for RPi4 USB ports and ethernet port. There is also an 8 mm diameter hole for a 5.5 mm barrel connector.

IMG_7429.jpeg


For reference at the time of writing (12/2021) here are prices in USD including priority shipping to my location (Detroit, MI US) for the three basic case options including front panel, bottom panel and rear panel machining.

3 mm front panel: $171
10 mm front panel, one sided machining: $189
10 mm front panel, double sided machining: $212

USB Wifi Dongle

I have been using RPis for a while as squeezelite end points and noticed that if I use the built in wifi I get the occasional drop out. As a result I switched to a more powerful USB wifi adapter. This option may not be the easiest as it does require you to install a driver but it seems to work really well. Instructions below walk through how to install the driver and change the wifi setup to use this adapter.

Do this while connected to LAN!

Instructions shown here were originally found here:
Rich (BB code):
sudo apt install -y dkms git build-essential
mkdir ~/src
cd ~/src
git clone https://github.com/morrownr/8821au-20210708.git
cd 8821au-20210708
./ARM64_RPI.sh
sudo ./install-driver.sh
sudo reboot

Run iwconfig from terminal and identify the name of your adapter. If you are using the same model as me it should be something like wlx984827e1c95c.

Rich (BB code):
sudo cp /etc/netplan/50-cloud-init.yaml /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg
sudo nano /etc/cloud/cloud.cfg.d/50-curtin-networking.cfg

Rich (BB code):
wifis:
        wlx984827e1c95c:
            access-points:
                networkname:
                    password: passed
            dhcp4: true
            optional: true

I also comment out the existing wlan0 entry so that only the USB adapter is used.

Rich (BB code):
sudo cloud-init clean
sudo cloud-init init
sudo reboot

That is it! Hope everyone finds this useful and if you have any questions or comments please let me know!

Michael
 

Attachments

  • Drawings.zip
    1.4 MB · Views: 188
  • flirc_01072024.py.zip
    1.2 KB · Views: 55
  • oled-rpi.gpio_03152024.py.zip
    11.2 KB · Views: 16
  • oled-lgpio_03152024.py.zip
    11.3 KB · Views: 8
Last edited:
D

Deleted member 23424

Guest
My UMIK-1 arrives tomorrow so logged in to see if I can find an Idiots Guide To REW when this literally popped up before my eyes.

Very much appreciated. Will be diving head first into this as soon as I've mastered REW.

Is the version of Camila baked into Moode the same as the one above?
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
My UMIK-1 arrives tomorrow so logged in to see if I can find an Idiots Guide To REW when this literally popped up before my eyes.

Very much appreciated. Will be diving head first into this as soon as I've mastered REW.

Is the version of Camila baked into Moode the same as the one above?

I don't know exactly what version is used in Moode but it will be some version of the same. Obviously a lot of the configuration stuff will be different but the GUI stuff should be the same. Biggest issue with Moode is the older kernel which doesn't support DACs like the MOTU Ultralite Mk5 but I imagine most 2 channel DACs are fine.

Michael
 

JRS

Major Contributor
Joined
Sep 22, 2021
Messages
1,158
Likes
1,003
Location
Albuquerque, NM USA
Very cool for doing this. Having some hand holding through this is what is motivating my purchase tomorrow. Any recs re processor, box display?
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Very cool for doing this. Having some hand holding through this is what is motivating my purchase tomorrow. Any recs re processor, box display?

For processor any of the RPi4s are fine (2 gb, 4 gb or 8 gb). Availability is a bit tough right now but they seem to pop up from time to time.

If you can find an Okto DAC8 pro that solves a lot of the fussing around but the MOTU Ultralite Mk5 option gets you pretty much the same functionality for less money.

For display it's buried in the thread but I used this one -> buydisplay.com 3.2” diagonal SSD1322 OLED display which is designed to work with the drawings in Part 4 and a Modushop GX247 case.

Michael
 

Sean Ku

Member
Joined
Nov 20, 2021
Messages
20
Likes
24
Intent of this thread is to provide a tutorial for setting up CamillaDSP on a RPi4. There is a lot of really good information scattered through ASR, DIYAudio and the CamillaDSP GitHub but there also appears to be a lot of apprehension. My goal is to describe in detail the how and why of implementing CamillaDSP with a variety of hardware and ease some of that apprehension.

I realize this tutorial is quite long and I am sure it looks pretty daunting to the uninitiated. I felt the same way when trying to figure this stuff out a few months ago. My advice is to take it step by step, go slowly and ask questions. Some DIY projects are not worth the effort but this one definitely is. At the end of this project you will have a DSP with almost unparalleled processing power in a very small form factor, easily configured via web interface all at a very low cost compared to other commercial options.

Before we get started I would like to especially @HenrikEnquist for developing CamillaDSP. I’ve long been skeptical of computer based DSP but CamillaDSP to me is a game changer. It easily runs on minimal hardware and overall just seems exceptionally well designed. I’ve replaced all of my miniDSP systems with RPi4s running CamillaDSP and could not be happier.

The tutorial will be divided in to 4 parts, Part 1 will talk through background on CamillaDSP, Part 2 will cover how to get a working CamillaDSP setup, Part 3 will document specific CamillaDSP configuration files for various multichannel DACs and Part 4 will talk through more advance stuff such as the GUI, displays, IR receivers, trigger output options and cases.

A lot of the motivation behind this thread started from the ASR Open Source Streamer thread and I would like to thank everyone that participated in that thread as it really pushed me to explore computer based DSP more. As this thread is really more based on how to use CamillaDSP rather than how to build a streamer (although that will also be covered!) I figured it was better to start a new separate thread.

As a disclaimer I am not a programmer or DSP expert, my primary motivation is finding better ways to implement DIY active speakers. If you see a better way to do something or want more explanation please speak up! These instructions have been developed over the last 6 months or so as I learned how to implement CamillaDSP and found better / quicker ways to set it up but I am always learning.
Bless you for doing this! I've gone the Moode route for my renderer, and have been trying to figure out how to extract the filters ARC Genesis applies in my Martin Logan Unison, so that I can rebuild them in Camilla, eliminate the Unison from my pipeline, and use a better DAC. I'm pretty sure I'm going to find this tutorial useful!
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
As I imagine a lot folks will want to try this with DACs other than the specific ones I recommended here are a few tips that might help.

Running aplay -l from the terminal will give you a list of all the audio devices you have installed that are recognized by ALSA. It should look something like this.

Screen Shot 2022-01-05 at 9.26.38 PM.png


As you can see the "ALSA name" is DAC8PRO. With this info you can run the command cat /proc/asound/YOURDACNAME/stream0 and it will list the supported bit depths and sample rates. Here you can see that I want to use S32LE in my CamillaDSP configuration and can use sample rates of 44100, 48000, 88200, 96000, 176400 or 196000. It is also important that this DAC has 8 output channels which will need to be exactly specified in the configuration file.

Screen Shot 2022-01-05 at 9.29.30 PM.png


Michael
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
Thank you soooo much for doing this, will be my weekend reading + experimenting.
Question: would it be possible to use different USB of the pi to output 2 channel signals to different standard two channel usb dacs? I understand latency could be an issue but still...
 
D

Deleted member 23424

Guest
I don't know exactly what version is used in Moode but it will be some version of the same. Obviously a lot of the configuration stuff will be different but the GUI stuff should be the same. Biggest issue with Moode is the older kernel which doesn't support DACs like the MOTU Ultralite Mk5 but I imagine most 2 channel DACs are fine.

Michael
Thanks Michael.

Just to confirm: Pi+Moode into Topping D90. Will the older kernel affect audio quality in any way? Or is it just a wider compatibility concern?
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Thank you soooo much for doing this, will be my weekend reading + experimenting.
Question: would it be possible to use different USB of the pi to output 2 channel signals to different standard two channel usb dacs? I understand latency could be an issue but still...

In general this is not a good idea unless you have some way to ensure the clocks are synced. IMO the best thing to do is to get a miniDSP U-DIO8 and two identical SPDIF or AES input DACs.

Michael
 
  • Like
Reactions: MCH

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
In general this is not a good idea unless you have some way to ensure the clocks are synced. IMO the best thing to do is to get a miniDSP U-DIO8 and two identical SPDIF or AES input DACs.

Michael
Thanks a lot, i understand. The u-dio8 is a bit of an overkill for me as i only aim for 4 channels (main and 2 subs max). Wonder if there is something similar for 4 channels. In any case the price of the dio8 is not prohibitive...
 

abdo123

Master Contributor
Forum Donor
Joined
Nov 15, 2020
Messages
7,425
Likes
7,941
Location
Brussels, Belgium
Have you tried decoding a DD+ 5.1 signal over Toslink from a TV? I have been considering transitioning from stereo to 5.1 audio but the moment you want any form of pre-outs from an AVR the price rises considerably.
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Thanks a lot, i understand. The u-dio8 is a bit of an overkill for me as i only aim for 4 channels (main and 2 subs max). Wonder if there is something similar for 4 channels. In any case the price of the dio8 is not prohibitive...

For a CamillaDSP setup a MOTU M4 is great for 4 channels. Although like I mentioned in the tutorial I would be inclined to go to for a miniDSP Flex as the price is similar once you add case + screen + IR receiver.

Michael
 
  • Like
Reactions: MCH
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Have you tried decoding a DD+ 5.1 signal over Toslink from a TV? I have been considering transitioning from stereo to 5.1 audio but the moment you want any form of pre-outs from an AVR the price rises considerably.

I have not. The only thing I have seen discussed is using a Meridan HD621 to split PCM HDMI in to 4 stereo AES or SPDIF outputs and routing those to either an Okto DAC8 pro or an U-DIO8. But I also must admit I am not very knowledgeable on home theater setups.

Michael
 

somebodyelse

Major Contributor
Joined
Dec 5, 2018
Messages
3,682
Likes
2,962
Nice writeup, thanks. Since you're using it for the FLIRC I guess you've not tried using the USB-C port as a USB input. A recent (5.14?) kernel update should make gadget audio compatible with Windows 10 but I've not got round to testing it yet.
 
Top Bottom