• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required as is 20 years of participation in forums (not all true). There are daily 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
1,400
Likes
1,688
Location
Detroit, MI
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 thank @HenrikEnquist for developing CamillaDSP. I’ve long been skeptical of computer based DSP but CamillaDSP 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.

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.
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
1,400
Likes
1,688
Location
Detroit, MI
Part 1: CamillaDSP Background

Why would I want to use CamillaDSP on a RPi?

CamillaDSP makes the most sense when you require DSP with 4 or more channels of digital output. In general this tutorial is geared towards 2 channel audio as it is somewhat difficult (although certainly not impossible!) to get multichannel audio in to a RPi. Typical applications are DIY active speakers / subwoofers such as Directiva R1 + sub (5-6 channels), LXmini + sub (5-6 channels) or LX 521.4 (8 channels). Another good application is stereo speakers with 3+ subwoofers. The reason I think CamillaDSP makes sense for more than 4 channels is that the newly introduced miniDSP Flex offers 4 channel DSP with good analog performance at a very reasonable price. That being said you can do a 4 channel RPi + CamillaDSP setup for less cost than the Flex and such a setup does have a few advantages such as more processing power and volume control with dynamic loudness.

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 22.04 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 allow configuration of 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 (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 Hifiberry HAT that provides input functionality. 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, HDMI output of the RPi, HAT DAC or HAT digital output. 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. This is probably the highest performance 8 channel DAC but availability is definitely an issue and long term support may be an issue.

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, 1RU half-rack, overall good analog performance. I recommend this DAC for almost all applications due to good analog performance, superior I/O functionality, reasonable price and smaller form factor.

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.

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.

As a side note I have tested a Focusrite 18i20 2nd gen and as of Ubuntu 22.04 it works well with USB and SPDIF inputs. However as analog performance is worse (higher noise) than the lower end miniDSPs I do NOT recommend it despite the $350 price tag, if you need lots of output channels save up and get the MOTU Ultralite Mk5.

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.
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
1,400
Likes
1,688
Location
Detroit, MI
Part 2: CamillaDSP Setup

This part will describe in detail how to get a working CamilllaDSP setup. Values shown in bold are user defined like your desired hostname or username, everything else is universal and can be copy / pasted as-is. Items entered in the 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.

I did a fresh install following this tutorial on my lunch break today directly copying the instructions in to the terminal so I am pretty confident there are not any typos in the important bits. For reference it took just under 1 hour (including display, FLIRC IR receiver and USB wifi setup which are included in Part 4), most of that time is waiting for things to download / install. @Madjalapeno had suggested an automated setup script and I may do that down the line but right now I do not have much desire to create / maintain a setup script.

1) Write Ubuntu Server 22.04 64 bit to micro SD card using Raspberry Pi Imager

Step by step instructions can be found here -> https://ubuntu.com/tutorials/how-to-install-ubuntu-on-your-raspberry-pi#1-overview

Follow instructions through step 3. Once you have set up wifi by modifying network-config on the micro SD card as explained you can insert the micro SD card in the RPi and power it up.

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 you might try one of the cards mentioned above.

2) Setup SSH

This install assumes you will managing the RPi remotely via SSH. If you are running Mac or Linux you will have terminal installed by default so you should be able to 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


Then run wsl --install in PowerShell and restart.

wsl install.png


Once you restart you should be able to open Ubuntu which will give you a terminal to enter commands from.

Ubuntu.png


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

3) Change host name

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 copy what is in your clipboard.

The next few steps assume you want to change your username and hostname, if you are fine with the defaults (username = ubuntu, hostname = ubuntu) you can skip to step 5.

Open terminal and log in to RPi4 remotely via SSH.

Rich (BB code):

Default password is ubuntu. On your first log in you will be required to change the password. Change password and log back in via ssh with your new password.

Rich (BB code):

Change hostname from ubuntu to desired hostname. In this case I am using a hostname of raspberrypi3. We will be using nano which is a lightweight terminal based text editor to do this and edit other text files throughout this tutorial.

Rich (BB code):
sudo nano /etc/hostname

Delete ubuntu from the hostname file and replace with your desired hostname (raspberrypi3). Once you are done use ctrl + x to exit, enter y when prompted to “Save modified buffer?” and hit enter. You will use similar steps when modifying other text files with nano throughout the tutorial.

Reboot RPi.

Rich (BB code):
sudo reboot

4) Change username

Wait a minute or two for RPi to reboot and log back in to RPi via ssh but use your new hostname.

Rich (BB code):
ssh [email protected]raspberrypi3

Create temp user and password for temp user so that you can log in as temp and change username.

Rich (BB code):
sudo useradd -G sudo temp
sudo passwd temp

Reboot RPi.

Rich (BB code):
sudo reboot

Log back in as temp user.

Rich (BB code):
ssh [email protected]raspberrypi3

Change user name from ubuntu to new username, in this example I am using michael3 as my username.

Rich (BB code):
sudo usermod -l michael3 ubuntu

Change home directory and group name to match new username (michael3).

Rich (BB code):
sudo groupmod --new-name michael3 ubuntu
sudo usermod -d /home/michael3 -m michael3

Reboot RPi.

Rich (BB code):
sudo reboot

Log back in with new username and host name.

Rich (BB code):
ssh michael3@raspberrypi3

Delete temp user.

Rich (BB code):
sudo deluser temp

5) Update / upgrade RPi

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 service, if so just hit enter.

Reboot RPi.

Rich (BB code):
sudo reboot

Log back in to RPi.

Rich (BB code):
ssh michael3@raspberrypi3

6) Install CamillaDSP

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

Rich (BB code):
mkdir camilladsp
cd camilladsp
mkdir coeffs
mkdir 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 22.04 64 bit.

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

Download and unpack CamillaDSP. The commands below will install V1.0.0.

Rich (BB code):
wget https://github.com/HEnquist/camilladsp/releases/download/v1.0.0/camilladsp-linux-aarch64.tar.gz
tar -xvf camilladsp-linux-aarch64.tar.gz

7) Create CamillaDSP yml configuration file

Assuming you are using one of the 3 DACs I 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 download "ultralitemk5_01052022.txt". In Windows open this file up with notepad or wordpad, in Mac use textedit.

Copy the text in the configuration file and use nano (see command below) to create a 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_01052022.txt [email protected]:/home/michael3/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

An ALSA loopback will create virtual soundcard that can be used as a CamillaDSP capture device. We will setup our players to use this loopback as a playback device so that sound is routed to CamillaDSP. If you are using a physical input (AES, TOSLINK, SPDIF, analog) you can skip this step.

By default ALSA loopback is not installed on Ubuntu Server 22.04 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 michael3@raspberrypi3

9) Try starting CamillaDSP

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

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

You should see an output similar to what is shown below in terminal. If it doesn't look like this because we added "-v" there will be a lot of good debugging information that can help you troubleshoot. To exit enter crtl + c.

Rich (BB code):
2022-03-30 00:09:16.275586 INFO [src/bin.rs:711] CamillaDSP version 1.0.0-rc3
2022-03-30 00:09:16.275758 INFO [src/bin.rs:712] Running on linux, aarch64
2022-03-30 00:09:16.276007 DEBUG [src/bin.rs:754] Read config file Some("/home/michael3/camilladsp/configs/ultralitemk5_streamer.yml")
2022-03-30 00:09:16.277815 DEBUG [src/bin.rs:773] Config is valid
2022-03-30 00:09:16.277943 DEBUG [src/socketserver.rs:260] Start websocket server on 127.0.0.1:1234
2022-03-30 00:09:16.278290 DEBUG [src/bin.rs:857] Wait for config
2022-03-30 00:09:16.278400 DEBUG [src/bin.rs:890] Config ready
2022-03-30 00:09:16.278997 DEBUG [src/filters.rs:450] Build new pipeline
2022-03-30 00:09:16.278998 DEBUG [src/bin.rs:213] Using channels [true, true]
2022-03-30 00:09:16.279157 DEBUG [src/alsadevice.rs:868] Buffer frames 4096
2022-03-30 00:09:16.279168 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279272 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279372 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279467 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279560 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279612 DEBUG [src/alsadevice.rs:883] Creating resampler
2022-03-30 00:09:16.279662 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279756 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279849 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.279942 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280033 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280126 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280220 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280314 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280404 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280495 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280590 DEBUG [src/filters.rs:355] Build from config
2022-03-30 00:09:16.280715 DEBUG [src/processing.rs:19] build filters, waiting to start processing loop
2022-03-30 00:09:16.296075 DEBUG [src/alsadevice.rs:377] Playback: supported channels, min: 10, max: 22, list: [10, 18, 22]
2022-03-30 00:09:16.296076 DEBUG [src/alsadevice.rs:377] 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]
2022-03-30 00:09:16.296226 DEBUG [src/alsadevice.rs:378] Capture: setting channels to 2
2022-03-30 00:09:16.296226 DEBUG [src/alsadevice.rs:378] Playback: setting channels to 18
2022-03-30 00:09:16.296368 DEBUG [src/alsadevice.rs:382] Capture: supported samplerates: Range(8000, 192000)
2022-03-30 00:09:16.296406 DEBUG [src/alsadevice.rs:382] Playback: supported samplerates: Discrete([88200, 96000])
2022-03-30 00:09:16.296518 DEBUG [src/alsadevice.rs:383] Playback: setting rate to 96000
2022-03-30 00:09:16.296535 DEBUG [src/alsadevice.rs:383] Capture: setting rate to 44100
2022-03-30 00:09:16.296666 DEBUG [src/alsadevice.rs:387] Playback: supported sample formats: [S24LE3]
2022-03-30 00:09:16.296716 DEBUG [src/alsadevice.rs:387] Capture: supported sample formats: [S16LE, S24LE, S24LE3, S32LE, FLOAT32LE]
2022-03-30 00:09:16.296791 DEBUG [src/alsadevice.rs:388] Playback: setting format to S24LE3
2022-03-30 00:09:16.296889 DEBUG [src/alsadevice.rs:388] Capture: setting format to S32LE
2022-03-30 00:09:16.297390 DEBUG [src/alsadevice.rs:419] Opening audio device "hw:Loopback,0" with parameters: HwParams { channels: Ok(2), rate: "Ok(44100) Hz", format: Ok(S32LE), access: Ok(RWInterleaved), period_size: "Ok(1024) frames", buffer_size: "Ok(8192) frames" }, SwParams(avail_min: Ok(4096) frames, start_threshold: Ok(0) frames, stop_threshold: Ok(8192) frames)
2022-03-30 00:09:16.297592 DEBUG [src/alsadevice.rs:424] Audio device "hw:Loopback,0" successfully opened
2022-03-30 00:09:16.297756 DEBUG [src/bin.rs:333] Capture thread ready to start
2022-03-30 00:09:16.301845 DEBUG [src/alsadevice.rs:419] Opening audio device "hw:UltraLitemk5" with parameters: HwParams { channels: Ok(18), rate: "Ok(96000) 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(3072) frames, stop_threshold: Ok(8192) frames)
2022-03-30 00:09:16.301996 DEBUG [src/alsadevice.rs:424] Audio device "hw:UltraLitemk5" successfully opened
2022-03-30 00:09:16.302146 DEBUG [src/bin.rs:323] Playback thread ready to start
2022-03-30 00:09:16.302249 DEBUG [src/bin.rs:326] Both capture and playback ready, release barrier
2022-03-30 00:09:16.302367 DEBUG [src/bin.rs:328] Supervisor loop starts now!
2022-03-30 00:09:16.302425 DEBUG [src/alsadevice.rs:909] Starting captureloop
2022-03-30 00:09:16.302762 DEBUG [src/processing.rs:21] Processing loop starts now!
2022-03-30 00:09:16.303202 INFO [src/alsadevice.rs:547] Capture device supports rate adjust
2022-03-30 00:09:16.303332 DEBUG [src/alsadevice.rs:215] Starting capture from state: SND_PCM_STATE_PREPARED, Ready to start
2022-03-30 00:09:16.303543 DEBUG [src/alsadevice.rs:815] Starting playback loop
2022-03-30 00:09:16.365714 INFO [src/alsadevice.rs:155] Starting playback from Prepared state
2022-03-30 00:09:18.677655 DEBUG [src/countertimer.rs:54] Pausing processing

10) Create CamillaDSP service

You will need to change "ExecStart" line to reflect your username. Note the “-g-40” item 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” as it will have no effect.

The "-p 1234" portion is only necessary if you are using the web GUI. The "-o /home/michael3/camilladsp/camilladsp.log" will create a log file that you can view 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
ExecStart=/home/michael3/camilladsp/camilladsp -g-40 -o /home/michael3/camilladsp/camilladsp.log -p 1234 /home/michael3/camilladsp/active_config.yml
Restart=always
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=camilladsp
User=root
Group=root
CPUSchedulingPolicy=fifo
CPUSchedulingPriority=10

[Install]
WantedBy=graphical.target

Enable camilladsp service.

Rich (BB code):
sudo systemctl enable camilladsp

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

12) Install pycamilladsp

Download pycamilladsp and install.

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

13) Install pycamilladsp-plot

Download pycmailldsp-plot and install.

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

14) Install GUI server

Commands will install V1.0.0-rc2 of the GUI, I will update once the final V1.0.0 GUI is released.

Rich (BB code):
wget https://github.com/HEnquist/camillagui-backend/releases/download/v1.0.0-rc2/camillagui.zip
unzip camillagui.zip -d 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 /home/michael3/camilladsp/camillagui/main.py

If all goes well you should see the following output. GUI is accessed via http://raspberrypi3:5000 from any web browser on your network.

Again, use crtl + c to exit.

Rich (BB code):
[email protected]:~$ python3 /home/michael3/camilladsp/camillagui/main.py
Backend configuration:
active_config: /home/michael3/camilladsp/active_config.yml
camilla_host: 0.0.0.0
camilla_port: 1234
coeff_dir: /home/michael3/camilladsp/coeffs
config_dir: /home/michael3/camilladsp/configs
default_config: /home/michael3/camilladsp/default_config.yml
on_get_active_config: null
on_set_active_config: null
port: 5000
supported_capture_types: null
supported_playback_types: null
update_symlink: true

======== Running on http://0.0.0.0:5000 ========
(Press CTRL+C to quit)

16) Create service to start GUI

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

You will need to change "ExecStart" line to reflect your username.

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

[Service]
User=michael3
Type=idle
ExecStart=python3 /home/michael3/camilladsp/camillagui/main.py

[Install]
WantedBy=multi-user.target

Enable camillagui service.

Rich (BB code):
sudo systemctl enable camillagui

Reboot RPi.

Rich (BB code):
sudo reboot

17) Assign active configuration in GUI

As of 05/04/2022 these instructions use a configuration file of ~/camilladsp/active_config.yml. This configuration is a symlink and the linked configuration needs to be set in the GUI.

Log back in to RPi.

Rich (BB code):
ssh michael3@raspberrypi3

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

Your GUI will show CamillaDSP as offline because nothing is yet linked to active_config.yml. Navigate to Files tab of the GUI and set your desired configuration as active by pressing the "A" next to the configuration you want. To load the configuration in to the GUI press the arrow button. From now on CamillaDSP and the GUI will start with this configuration loaded.

1651707632386.png


Congratulations, you now have CamillaDSP up and running!
 
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
1,400
Likes
1,688
Location
Detroit, MI
Part 3: CamillaDSP Configurations

In my mind there are two basic ways to use CamillaDSP, one is using the RPi as a streamer and the other is using some other input like a TOSLINK, SPDIF, AES or analog input. I will document configuration files for both streamer and external input setups for each of the 3 recommended DACs in the previous post. The configurations are simple and route a 2 channel input to all available outputs, volume control is included on all channels for DACs other than the Okto.

These configuration files are designed to run at 96 kHz. I like 96 kHz as a DSP sample rate as it avoids high frequency warping and it is not too demanding from a resource standpoint. For external inputs a good way to resample to 96 kHz is using something like a miniDSP OpenDRC-DI which has an ASRC that resamples all inputs to 96 kHz, this also gives you a place to do source selection. 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";
port = 6000;
drift_tolerance_in_seconds = 0.010;
output_device = "hw:Loopback,1";

Using SOX for interpolation should avoid audible artifacts from clock syncing. It is important to change port to 6000 as the CamillaGUI uses the default port 5000. I’ve found that an increased drift tolerance of 0.010 prevents over correction with USB DACs. The last line sets the output device to your ALSA loopback device 1.

Airplay will automatically resample to a 44.1 kHz sample rate, as a result all of my configuration files are set up such that they expect a 44.1 kHz sample rate.

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"

These changes will set your ALSA loopback device 1 as the 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=graphical.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.

Note, all configurations are set to use the maximum amount of output channels. If you do not need an output channel I recommend removing it from the mixer as each extra channel requires additional processing resource. All configuration files are attached to this post. I started adding dates to the configuration files to track any changes.

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 avoid clipping from resampling, 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. If you want to use CamillaDSP volume control just delete the # in front of the volume filters in the pipeline (see other configurations as examples).

Streamer - okto.txt

When using the RPi as a source you will want your Okto to be in “Pure USB” mode. For the first configuration file I have added comments to help understanding, others have less comments.

AES Input - okto_aes.txt

Set the Okto to “USB / AES” mode. This configuration assumes you are using 2 channel input with 8 channels of output. If you are using more channels of input you can easily modify the mixer to do so but you need to make sure they are all sync’d as noted in the Okto owners manual. Again I am assuming you are NOT using CamillaDSP for volume control. I originally started with resampling and rate adjust enabled but it appears that the Okto has it’s own rate adjust functionality, if you see your buffer level dropping low just uncomment to enable resampling and rate adjust.

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 that no other channel routing is in place as we will do all channel routing in CamillaDSP. Change the sample rate to 96 kHz and change the optical input / output to TOSLINK as I am assuming most folks with consumer gear will be using TOSLINK not ADAT (you can also change this on the front panel). Check your output levels 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 to be controlled by the knob. It would also be 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.

I figure it is best to document the inputs / outputs of Mk5 before jumping in as it has a lot and these will be referenced in the configuration files. The input / outputs depend on sample rate, everything shown here is for 96 kHz.

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

Outputs:
0-9: analog 1-10
10-11: headphone 1-2
12-13: SPDIF 1-2
14-15: TOSLINK 1-2
16-17: ADAT 3-4

Once you have the 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 an USB IR receiver and separate display for volume indication as described in Part 4. These configuration files use all analog and digital outputs with the exception of the ADAT outputs.

Streamer - ultralitemk5.txt

When using the Mk5 with a USB input you want the clock source set to Internal, you can do this from the Mk5 front panel. There is no need to set the sample rate, the Mk5 will automatically adjust to the CamillaDSP set sample rate.

TOSLINK input - ultralitemk5_toslink.txt

Set the clock source to Optical on the Mk5 front panel.

SPDIF input - ultralitemk5_spdif.txt

Set the clock source to SPDIF on the Mk5 front panel.

Analog input - ultralitemk5_analog.txt

Set the clock source to Internal on the Mk5 front panel. This configuration uses analog 3 and 4 as inputs but you can easily add other inputs as needed.

MOTU M4

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

Streamer - m4.txt

Analog input - m4_analog.txt

This configuration uses analog inputs 3 and 4 but you can others if needed.
 

Attachments

  • okto_aes_01192022.txt
    1.5 KB · Views: 60
  • okto_01192022.txt
    3.7 KB · Views: 96
  • m4_analog_01052022.txt
    1.2 KB · Views: 130
  • m4_01052022.txt
    1.2 KB · Views: 156
  • ultralitemk5_01052022.txt
    3.3 KB · Views: 77
  • ultralitemk5_analog_01052022.txt
    3.3 KB · Views: 57
  • ultralitemk5_toslink_01052022.txt
    3.3 KB · Views: 42
  • ultralitemk5_spdif_01052022.txt
    3.3 KB · Views: 60
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
1,400
Likes
1,688
Location
Detroit, MI
Part 4: Advanced Configuration

This is where things get fun! When looking at these options you will notice that the Okto has a lot of really nice features that are not available on the other DACs, namely IR volume control, a big volume display and a trigger output. Wouldn’t it be great if we could get the same functionality on the other DACs? Turns out you can do this relatively easily. In this section I will talk through implementing improvements to achieve the above mentioned functionality and will also cover a few other areas like USB wifi dongles and how to use the CamillaDSP GUI.

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. Pair your remote so that volume up is key up and volume down is key down.

Install evdev.

Rich (BB code):
sudo pip3 install evdev

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

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

As of 03/29/2022 the FLIRC python script has some very simple source / configuration switching. As of 05/04/2022 the FLIRC python script slightly changed the way that source switching is implemented as the tutorial changed to using a symlink configuration (active_config.yml). If you want to implement source / configuration switching first pair KEY RIGHT to your desired source switching remote button in the FLIRC pairing software. Then edit flirc.py and edit the active, temp, config1 and config2 so they reflect your specific user name and configuration files. The default code will switch between an an analog input configuration for a MOTU M4 called "m4_analog.yml" and a streamer configuration called "m4_streamer.yml" by updating the active_config.yml symlink. There is a lot of flexibility here so let me know if there is another source or configuration change you would like to see implemented.

Rich (BB code):
active = "/home/michael3/camilladsp/active_config.yml"
temp = "/home/michael3/camilladsp/temp.yml"
config1 = "/home/michael3/camilladsp/configs/m4_streamer.yml"
config2 = "/home/michael3/camilladsp/configs/m4_analog.yml"

Create service to start FLIRC python script. You will need to change "ExecStart" line 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
ExecStart=python3 /home/michael3/flirc.py
Restart=always
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=flirc
User=root
Group=root

[Install]
WantedBy=graphical.target

Enable FLIRC service.

Rich (BB code):
sudo systemctl enable flirc

Enable USB-C port for use, this is needed if you want 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).

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

Add ,dr_mode=host after dtoverlay=dwc2 so that the final line looks like:

Rich (BB code):
dtoverlay=dwc2,dr_mode=host

Trigger Output

It is pretty easy to add a trigger output to the MOTU Ultralite Mk5 using a Bobwire DAT1. All you need to do is to connect the TOSLINK output of the 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 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

A very nice feature of the RPi is it has 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 I am sure 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 changes.

As of 03/29/2022 I also added some flexibility to the top line of the display to support source switching. If the capture device is "hw:Loopback,0" it will show "Streamer", if it is "hw:M4" it will show "Analog" and if it is something else it will show "CamillaDSP". This should be pretty easy to edit in the future to accommodate things like different configuration names or inputs on other devices.

Install lgpio.

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

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

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

Create service to start OLED python script. You will need to change "ExecStart" line to reflect your username.

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

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

[Service]
Type=simple
ExecStart=python3 /home/michael3/oled.py
Restart=always
RestartSec=1
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=flirc
User=root
Group=root

[Install]
WantedBy=graphical.target

Enable OLED service.

Rich (BB code):
sudo systemctl enable oled

Wiring configuration from the display to the RPi GPIO header is listed below.

01 -> ground
02 -> 3.3 V
03 -> no connection
04 -> GPIO 26
05 -> GPIO 13
06 -> GPIO 6
07 -> GPIO 5
08 -> GPIO 22
09 -> GPIO 27
10 -> GPIO 17
11 -> GPIO 18
12 -> GPIO 23
13 -> ground
14 -> GPIO 16
15 -> GPIO 12
16 -> 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.

As an example of what the final functionality looks like see video below. This video demonstrates pretty much all the functionality including the MOTU M4 source switching.


Modushop Case

Modushop offers CNC machining of aluminum cases for custom projects. You provide the CAD files and they will do the machining. In general 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 really hate the 1 mm steel cover option as these are rather flimsy.

All case designs discussed below are designed to be used with a display and IR receiver. Drawings in dwg, pdf and vsdx format are attached to this post 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 usually 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 my solution was to use an USB A socket to USB C plug adapter on the USB-C port coupled with a panel mount USB A extension cable. This allows the IR receiver to be connected 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. I soldered some 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 both 5 V wires and both ground wires to the pin header. The doubling wiring is likely overkill but I wanted to make sure I avoided under voltage issues. I do definitely recommend using at least 20 awg here. This is the only part of the project that requires soldering. That being said if you are totally against soldering you can purchase a 5.5 mm x 2.1 mm jack with prefabbed wiring and then crimp some prefabbed 20 awg 0.1” header wiring on the ends. If you do this it is likely you will 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 just get a 5.5 mm power supply. I used a Meanwell GSM25B05-P1J (5 V @ 4 A) I had laying around. Your power supply should be at least 5 V @ 3 A.

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 certainly possible to modify the layout of the text so that it is more 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 5 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 matches 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 definitely 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 might be able to save money. For example it is certainly possible to leave the back panel completely off which is a way 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 the 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 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 would get the occasional drop out. As a result I switched to a more powerful USB wifi adapter. This option may not be the best 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

Using the GUI

As mentioned previously you can view the GUI by going to any browser on your network and entering http://raspberrypi3:5000 (where raspberrypi3 is the host name of your RPi running CamillaDSP).

By default the GUI will show the configuration file that you specified in ~/camillagui/config/camillagui.yml which may or may not be loaded as the active DSP profile. If you followed the instructions in this tutorial the default will be to load the configuration file at ~/configs/camilladsp.yml which is what will be loaded when CamillaDSP starts. When you make changes to the configuration in the GUI they will not take effect until you click the Apply to DSP button.

If you have any doubt on what configuration is loaded on the DSP you can click the Fetch from DSP button and it will show you the current configuration in the GUI.

Unless you save the changes to your configuration in ~/camilladsp/configs/camilladsp.yml any changes you make in the GUI (even if you load them to the DSP) will go away after CamillaDSP restarts.

Personally I like to have a few configuration files located in ~/configs. The GUI will show these as options under the Files tab so you can switch between them easily by clicking the Load in to GUI button and then clicking the Apply to DSP button. Once I have decided on what configuration file to use going forward I will save it in to ~/camilladsp/configs/camilladsp.yml and it will be loaded in the future. We will discuss how to do this when we go through the Files tab.

Let’s talk about the basic layout of the GUI. The first tab is the Devices tab, in general this will stay the same as it defines general parameters like capture device, playback device, sample rate and chunk size.

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


In the Filters tab you can add any filter you want. A big advantage to using the GUI over the manual configuration file is that it will prompt you for the necessary information for the filter type you are using. Once you have crated a filter you can also view the magnitude / phase response 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.

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


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

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


The Pipeline tab is where everything comes together, this is where you apply the filters and mixer created in the previous tab. You can also plot the entire pipeline which will show you the how the mixer and filters are applied as well as the combined filter magnitude / phase response on each channel.

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


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


The Files tab stores configuration and convolution filters. It will show you any configuration files located in ~/camilladsp/configs/ and any convolution filters located in ~/camilladsp/coeffs/. You can also upload configurations and convolution filters from your local computer. You can also save the configuration currently loaded in to the GUI to either a new configuration file or an existing one. Remember that by default ~/camilladsp/configs/camilladsp.yml is the configuration loaded in to CamillaDSP and the GUI so whatever configuration you want loaded by default should be saved there.

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


Here are few things that I am thinking about implementing but currently do not have tons of motivation to do.

1) Sample rate switching, rather than have the player resample could have CamillaDSP load different configuration files as the source sample rate changes.

2) Source switching, with something like the MOTU Ultralite Mk5 would be nice to be able to switch sources and the click of a remote button, this is somewhat complicated by the need to change clock source for different sources.

3) Other players, would be interested in what other software players folks may be interested in as providing instructions should be pretty easy.

Something I do plan on doing is buying a digital output miniDSP Flex once it becomes available. This will provide an ideal front end to the MOTU Ultralite Mk5 as it has a built in ASRC, good input functionality, a display and a volume knob. Although I imagine it will be more expensive than a DIY case with display and IR receiver I think the extra functionality is worth it. The only downside is that CamillaDSP can implement dynamic loudness with it’s volume control and the miniDSP cannot.

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: 37
  • flirc_05042022.txt
    2.4 KB · Views: 23
  • oled_05042022.txt
    71.1 KB · Views: 16
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
1,400
Likes
1,688
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

Addicted to Fun and Learning
Joined
Sep 22, 2021
Messages
830
Likes
715
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
1,400
Likes
1,688
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
23
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
1,400
Likes
1,688
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
 

MarcosCh

Addicted to Fun and Learning
Joined
Apr 10, 2021
Messages
981
Likes
650
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
1,400
Likes
1,688
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
 

MarcosCh

Addicted to Fun and Learning
Joined
Apr 10, 2021
Messages
981
Likes
650
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
5,977
Likes
5,917
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
1,400
Likes
1,688
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
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
1,400
Likes
1,688
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
2,731
Likes
2,064
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