• 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

OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
Thanks. The ECM8000 is available just down the road from me for about at third of the price of the UMIK-1. It has an XLR interface, so would it be ok to use with the MOTU M4 and a TRS adapter? It might be a bit inconvenient to walk around the room with the laptop + M4 + microphone though, but it's doable I guess.

The UMM-6 is available via Amazon slightly cheaper than the UMIK-1. Which is the better option of the two?

The M4 preamp channels 1 and 2 have XLR-TRS combination jacks so no need for an adapter. An analog mic has the advantage of being able to use a loopback as a timing reference which means you can measure phase which you cannot reliably do with a USB mic. Otherwise in terms of which one is “better” I really don’t know. Personally I use a Dayton EMM-6 which is their XLR based offering.

Michael
 

Eternalight

Member
Joined
Jul 31, 2022
Messages
11
Likes
0
This is strange, the green bars mean that camilladsp thinks everything is ok.
Can you try to use speaker test to the same device that camilladsp uses? Shut down camilladsp, and then type:
speaker-test -D hw:audioinjectoroc -c 8 -r 44100

You should get noise in one channel at a time, moving to the next channel after a few seconds. If this doesn't work, the also camilladsp won't.
TDLR: I'm stuck at step 2 in the camilldsp-config guide

Step 2: Load loopback driver on boot​


Not to change gears. but I said "f it" to rasbian. Things wouldn't show up properly if Pulseaudio was installed. Purged.
Tried installing pipewire. Pulled from repo for overly agressive takeover of pulse audio devices.
Wireplumber servers offline. can't install.
Reading about ubuntu 5.10. ALSA partly depreciated, Pulseaudio completely gone. It's pure Pipewire.
Installed daily image.
No boot. edited config.txt. hmm that's strange commands in there. mirrored rasbian settings, fixed.
ie. dtoverlay=dwc2 was in there twice and dtoverlay=vc4-kms-v3d should be dtoverlay=vc4-fkms-v3d

Downloaded Octo 8 driver. error. opened up deb fix recreated install script. Repackaged. Ran.
config.txt has audioinjector overlay. Asound.conf in /etc .asoundrc in home directory
Sound panel has "Built-In" multichannel output ;-)
Browser audio works, VLC works, You're speakertest command works. Sounds great. (Thank you Tinnitus. That would have been a bad case of tinnitus)

Now....
The Camilladsp config readme seems to be going down the path of the ALSA path.
Is there a way to bypass the HW:Loopback 0/1 and go straight raw input to stin or do pipewire without jack or pulse?
The reason I ask is that 1. it's baked into the system no setup required.
and 2. SND-ALOOP doesn't exist, either because 5.10 is not released yet (not fully baked) or that since ALSA is partial depreciated (whatever that means) snd-aloop will not be included in the kernel going forward.



Sincerely,

David Piel
 

Attachments

  • Screenshot from 2022-08-05 19-36-19.png
    Screenshot from 2022-08-05 19-36-19.png
    121.3 KB · Views: 77
Last edited:
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
TDLR: I'm stuck at step 2 in the camilldsp-config guide

Step 2: Load loopback driver on boot​


Not to change gears. but I said "f it" to rasbian. Things wouldn't show up properly if Pulseaudio was installed. Purged.
Tried installing pipewire. Pulled from repo for overly agressive takeover of pulse audio devices.
Wireplumber servers offline. can't install.
Reading about ubuntu 5.10. ALSA partly depreciated, Pulseaudio completely gone. It's pure Pipewire.
Installed daily image.
No boot. edited config.txt. hmm that's strange commands in there. mirrored rasbian settings, fixed.
ie. dtoverlay=dwc2 was in there twice and dtoverlay=vc4-kms-v3d should be dtoverlay=vc4-fkms-v3d

Downloaded Octo 8 driver. error. opened up deb fix recreated install script. Repackaged. Ran.
config.txt has audioinjector overlay. Asound.conf in /etc .asoundrc in home directory
Sound panel has "Built-In" multichannel output ;-)
Browser audio works, VLC works, You're speakertest command works. Sounds great. (Thank you Tinnitus. That would have been a bad case of tinnitus)

Now....
The Camilladsp config readme seems to be going down the path of the ALSA path.
Is there a way to bypass the HW:Loopback 0/1 and go straight raw input to stin or do pipewire without jack or pulse?
The reason I ask is that 1. it's baked into the system no setup required.
and 2. SND-ALOOP doesn't exist, either because 5.10 is not released yet (not fully baked) or that since ALSA is partial depreciated (whatever that means) snd-aloop will not be included in the kernel going forward.



Sincerely,

David Piel

I have no idea as I always run headless with ubuntu server which has plain Jane ALSA. Maybe try asking Henrik in the diy audio thread? Otherwise I would suggest installing ubuntu server and then installing a GUI on top of it which should allow you to roughly follow this tutorial (I assume you are not using a Raspberry Pi).

Michael
 

Eternalight

Member
Joined
Jul 31, 2022
Messages
11
Likes
0
I have no idea as I always run headless with ubuntu server which has plain Jane ALSA. Maybe try asking Henrik in the diy audio thread? Otherwise I would suggest installing ubuntu server and then installing a GUI on top of it which should allow you to roughly follow this tutorial (I assume you are not using a Raspberry Pi).

Michael
I am. but with ubuntu Kinetic desktop on it
 

Eternalight

Member
Joined
Jul 31, 2022
Messages
11
Likes
0
You are using ubuntu server? Or a RPi? Or both? Why use kinetic over jammy?

Michael
I'm using Raspberry pi with 22.10 ubuntu Kinetic Kuzu. Coming out in October. Because it has no pulse and native pipewire through out nothing else. and wireplumber
i.e. aplay -l returns audioinjector card 0. thats it. none of that other crap to mess things up. (You can tell I'd take Satan over Pulseaudio any day, that's how much I hate it)
 
Last edited:

phofman

Senior Member
Joined
Apr 13, 2021
Messages
489
Likes
319
There is no need to fuss with pulseaudio, just tell PA to ignore the soundcard (using PA GUI or CLI utilities) and leave PA as is.
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
I am doing some simple baseline testing at the command line.

I have a 2 channel WAV file (cd quality) that I want to output as a 4 channel WAV (cd quality).

I tested without a mixer (i.e. 2->2) (dd if=testin.wav | ./camilladsp /home/ricko/camilladsp/test.yml | dd of=testout.wav) and the resultant file was playable.

Adding in the mixer config (done manually based on example in camilladsp website) results in a run time error of "Pipeline outputs 2 channels, playback device has 4"

In my (simple) mind, the input (capture aka stdin) is 2 channels and the output (playback aka stdout) is 4 but thats how it thinks about life.

Can someone point in the right direction with regard to the mixer config?

Thanks,

Peter

My config file is:

devices:
samplerate: 44100
chunksize: 1024
queuelimit: 4
adjust_period: 10
enable_rate_adjust: false
enable_resampling: false
capture_samplerate: 44100
stop_on_rate_change: false
rate_measure_interval: 1.0
capture:
type: Stdin
channels: 2
format: S16LE
extra_samples: 123
skip_bytes: 0
read_bytes: 0
playback:
type: Stdout
channels: 4
format: S16LE
mixers:
ExampleMixer:
channels:
in: 2
out: 4
mapping:
- dest: 0
sources:
- channel: 0
gain: 0
inverted: false
- dest: 1
sources:
- channel: 1
gain: 0
inverted: false
- dest: 2
sources:
- channel: 0
gain: 0
inverted: false
- dest: 3
sources:
- channel: 1
gain: 0
inverted: false
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
I am doing some simple baseline testing at the command line.

I have a 2 channel WAV file (cd quality) that I want to output as a 4 channel WAV (cd quality).

I tested without a mixer (i.e. 2->2) (dd if=testin.wav | ./camilladsp /home/ricko/camilladsp/test.yml | dd of=testout.wav) and the resultant file was playable.

Adding in the mixer config (done manually based on example in camilladsp website) results in a run time error of "Pipeline outputs 2 channels, playback device has 4"

In my (simple) mind, the input (capture aka stdin) is 2 channels and the output (playback aka stdout) is 4 but thats how it thinks about life.

Can someone point in the right direction with regard to the mixer config?

Thanks,

Peter

My config file is:

devices:
samplerate: 44100
chunksize: 1024
queuelimit: 4
adjust_period: 10
enable_rate_adjust: false
enable_resampling: false
capture_samplerate: 44100
stop_on_rate_change: false
rate_measure_interval: 1.0
capture:
type: Stdin
channels: 2
format: S16LE
extra_samples: 123
skip_bytes: 0
read_bytes: 0
playback:
type: Stdout
channels: 4
format: S16LE
mixers:
ExampleMixer:
channels:
in: 2
out: 4
mapping:
- dest: 0
sources:
- channel: 0
gain: 0
inverted: false
- dest: 1
sources:
- channel: 1
gain: 0
inverted: false
- dest: 2
sources:
- channel: 0
gain: 0
inverted: false
- dest: 3
sources:
- channel: 1
gain: 0
inverted: false

solved!!!

I had buggered around with the GUI and did so some more... needed to add in a pipeline... so appended this to the end of the config and it generated a WAV file:

pipeline:
- name: ExampleMixer
type: Mixer


Using some WAV file programs, the resultant file presents four channels... but on playback it sounds like its on half speed... which probably makes sense cause I am playing it back via my PC stereo playback stack.

My 4 channel DAC will arrive soon and will then see whats what.

As with all things new, its a learning curve.

Thanks,

Peter
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
Moving right along to phase 2, using sox for upsampling (for my own personal reasons) I get a 44.1/16 two channel WAV -> four channel 96/24 (well really its 32bit) WAV that plays fine.

So all thats left now is phase 3 which is adding in filters to handle a high pass filter on channels 2 and 3 (zero based) and apply a common EQ at various know points to all channels.

Now it gets interesting!!!

Peter


dd if=testin.wav |./camilladsp /home/ricko/camilladsp/four.yml | sox -V -D -t raw -b 16 -e signed -c 4 -r 44.1k - -t wav -C 0 -b 24 --buffer 131072 - gain -h -n -2 rate -v -b 95.4 -p 45 -a 96000 | dd of=testout.wav

soxbin: SoX v14.4.3

Input File : '-' (raw)
Channels : 4
Sample Rate : 44100
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no

Output File : '-' (wav)
Channels : 4
Sample Rate : 96000
Precision : 24-bit
Sample Encoding: 24-bit Signed Integer PCM
Endian Type : little
Reverse Nibbles: no
Reverse Bits : no
Comment : 'Processed by SoX'

2022-08-08 07:34:09.314033 INFO [src/bin.rs:711] CamillaDSP version 1.0.1
2022-08-08 07:34:09.314071 INFO [src/bin.rs:712] Running on linux, x86_64
soxbin INFO sox: effects chain: input 44100Hz 4 channels
soxbin INFO sox: effects chain: gain 44100Hz 4 channels
soxbin INFO sox: effects chain: rate 96000Hz 4 channels
soxbin INFO sox: effects chain: output 96000Hz 4 channels
111068+1 records in
111068+1 records out
56867256 bytes (57 MB, 54 MiB) copied, 0.921074 s, 61.7 MB/s
2022-08-08 07:34:10.235962 INFO [src/bin.rs:420] Capture finished
2022-08-08 07:34:10.236449 INFO [src/bin.rs:410] Playback finished
725353+1 records in
725353+1 records out
371381000 bytes (371 MB, 354 MiB) copied, 16.8384 s, 22.1 MB/s
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
QUESTION

As per the Camilla doco, because I am going from 44.1 to 96k, I can use the 'Synchronous" resample type in Camilla (needed to set the gain to -6db in the mixer to avoid clipping).

The Camilla upsampling is way quicker than sox, so anyone got an opinion on the which might be better quality wise (sox or Camilla/Rubato)?

If they are comparable then I might drop sox, given the massive speed differential.

Thanks,

Peter
 

HenrikEnquist

Member
Joined
Jul 1, 2021
Messages
82
Likes
110
I am doing some simple baseline testing at the command line.

I have a 2 channel WAV file (cd quality) that I want to output as a 4 channel WAV (cd quality).

I tested without a mixer (i.e. 2->2) (dd if=testin.wav | ./camilladsp /home/ricko/camilladsp/test.yml | dd of=testout.wav) and the resultant file was playable.
CamillaDSP does not support input and output in wav format!
If you do this, then it will read the wav header as audio data. If you don't do any filtering or resampling, and read and write in the same format, then it should just copy the header from input to output. But if the signal is modified even slightly by some filter, then the header will become garbage.

Best way is to use some other tool to convert between raw data and wav. I usually use Audacity, but there are plenty of other options. If you want a cli tool you can use for example sox.
 

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
CamillaDSP does not support input and output in wav format!

Yes understand that.

The "wav" file I mentioned above was in fact raw (I had done a sox null process on the original wav file to make it raw).... I just kept the extension the same.

Also the above testing was just simple command line stuff while I got to grips with Camilla (i.e. its easier to check end results by having a physical file than trying to test via a DAC esp when I didnt have a multichannel DAC until today).

Just a few minutes ago I completed my final viability tests for my use case (not that I doubted your work!!!) using alsa loopback (as I would do in "production"), taking 2 channel 44.1/16 to four channel 96/24, applying gain reduction for headroom and applying a roll off filter on the new surround channels (clones of front L+R).

The final steps will be 10 points of PEQ which I will do a bit later.

It obviously makes sense to use the inbuilt resampling in Camilla rather than do this externally.

So all is good and I have to commend you on this great tool and the fact you made it open source.

Thanks,

Peter
 
Last edited:

fatoldgit

Active Member
Joined
Feb 29, 2020
Messages
279
Likes
326
@HenrikEnquist

In my resampling use case (44.1/16->96/24) when using Camilla to do the resampling (via asla loopback), do I need to care about alsa getting in the way (i.e. if I havent configured asound stuff etc I assume that Camilla stops alsa trying to screw the proceedings up)?

Thanks,

Peter
 

HenrikEnquist

Member
Joined
Jul 1, 2021
Messages
82
Likes
110
@HenrikEnquist

In my resampling use case (44.1/16->96/24) when using Camilla to do the resampling (via asla loopback), do I need to care about alsa getting in the way (i.e. if I havent configured asound stuff etc I assume that Camilla stops alsa trying to screw the proceedings up)?

Thanks,

Peter
As long as camillsdsp keeps the loopback open, the format and sample rate are locked. As long as you play only 44.1kHz material it's all good. If you play something else, then it depends on the player app what actually happens. The loopback will stay at 44.1, so resampling is needed. Some apps do this resampling themselves, some let Also do it by opening the device with plughw (which uses a fast but not very high quality resampler), and some just refuse to play.
What player app or apps are you using?
 
OP
M

mdsimon2

Major Contributor
Forum Donor
Joined
Oct 20, 2020
Messages
2,478
Likes
3,316
Location
Detroit, MI
FYI I recently tried using the daily build of ubuntu server kinetic kudu with the proposed repository to upgrade to the 5.19 kernel and CamillaDSP 1.1 to use gadget mode (USB input) and it works great with everything described in this tutorial. Only downside is you need to use the usb-c port for USB input so need to switch the IR receiver to one of the usb-a ports which means my case design needs to be modified (or just leave off the rear panel).

If you are only interested in USB input this can allow for automatic switching of sample rates to eliminate any resampling as described in this tutorial -> https://www.audiosciencereview.com/...sb-source-ipad-and-usb-dac.25414/post-1180356. Otherwise if you want to switch between USB and other inputs you can setup the gadget to run at one sample rate (say 96 kHz) and switch between configs in the GUI for different inputs.

When kinetic kudu and CamillaDSP 1.1 are released I will update the tutorial to include gadget mode.

Michael
 

juliangst

Addicted to Fun and Learning
Joined
Dec 11, 2021
Messages
957
Likes
980
Location
Germany
I'm using the moOde Player that also has CamillaDSP.

Does CamillaDSP support the following Hifiberry DAC+ DSP setup:
- Hifiberry RCA out to a sub with lowpass and correction
-optical out to a DAC that feeds the amp for the main speakers (with highpass and correction)
-optical in from a TV

I basically want to do everything a MiniDSP flex can do (for less than the 750€ for the balanced flex).
It has to be as stable as a minidsp (I don't want to send full signal to my speaker amp because of a system error).
And I want to keep streaming functionality from moOde but also have an optical input for something like a TV.
 

MCH

Major Contributor
Joined
Apr 10, 2021
Messages
2,581
Likes
2,199
I'm using the moOde Player that also has CamillaDSP.

Does CamillaDSP support the following Hifiberry DAC+ DSP setup:
- Hifiberry RCA out to a sub with lowpass and correction
-optical out to a DAC that feeds the amp for the main speakers (with highpass and correction)
-optical in from a TV

I basically want to do everything a MiniDSP flex can do (for less than the 750€ for the balanced flex).
It has to be as stable as a minidsp (I don't want to send full signal to my speaker amp because of a system error).
And I want to keep streaming functionality from moOde but also have an optical input for something like a TV.
I believe that what you want to do is feasible (except if you want dirac live) but i am not sure if the hifiberry you mention and moode are the way to do it. Maybe others can chime in.

A budget option could be a Motu M4 for the outputs (has the 4 channels that you need) and a toslink to usb card for the input. See here:

Post in thread 'RPi4 + CamillaDSP Tutorial' https://audiosciencereview.com/forum/index.php?threads/rpi4-camilladsp-tutorial.29656/post-1214079

What i am pretty sure is that moodeaudio will not allow you to bring spdif inputs. There are only two cards that can give aditional inputs to moode. See:


I would stick to this tutorial intead of moodeaudio and you can get the toslink input and the streaming capabilities (not moode) that you need.
 

juliangst

Addicted to Fun and Learning
Joined
Dec 11, 2021
Messages
957
Likes
980
Location
Germany
I believe that what you want to do is feasible (except if you want dirac live) but i am not sure if the hifiberry you mention and moode are the way to do it. Maybe others can chime in.

A budget option could be a Motu M4 for the outputs (has the 4 channels that you need) and a toslink to usb card for the input. See here:

Post in thread 'RPi4 + CamillaDSP Tutorial' https://audiosciencereview.com/forum/index.php?threads/rpi4-camilladsp-tutorial.29656/post-1214079

What i am pretty sure is that moodeaudio will not allow you to bring spdif inputs. There are only two cards that can give aditional inputs to moode. See:


I would stick to this tutorial intead of moodeaudio and you can get the toslink input and the streaming capabilities (not moode) that you need.
Thanks! Let's just ignore inputs (I could just use Airplay instead of optical).

Does CamillaDSP work with the Hifiberry board and let me adjust all 4 channels (2 RCA and 2 Toslink channels)?
Or are there other HAT options with multiple outputs (digital outputs preferred) that work with CamillaDSP?
It would be a lot cheaper than the Motu and let's me use my own DAC for the mains.
 
Top Bottom