CamillaDSP - Cross-platform IIR and FIR engine for crossovers, room correction etc

Is there a way to plot the "end to end" frequency and phase response of a pipeline ?

When I run plotcamillaconf it plots freq and phase for each individual filter and eq - It would be really useful to be able to plot "end to end"
I have thought a little about what to do about end-to-end plots. It's no problem to calculate the frequency response from an input to an output. The problem that comes, is to decide what channels combibations to plot.
Take this somewhat strange surround-to-stereo setup (just made to illustrate the problem):
pipeline.png
What should the end-to-end plot show here?
The best I have come up with is to show the frequency response at each output channel, assuming all input channels are fed an identical signal with flat FR. Looking at output 0, it's the sum of input input 0, delayed 2, HP filtered 4 and LP filtered 5. Ingoring 4&5, the sum of 0 and delayed 2 will give interference. But in reality the signals on input 0 and 2 are different, and this won't happen.

Another way would be to let the contribution of each input channel be a separate curve in the plot. The problem with this is that it can become quote messy.
What do people think, how should this be presented?
 
A fully generalized plotter would of course be great but maybe you should just start from a basic assumption of a stereo setup - 2 channels in - 2 channels out (via 2 loudspeakers that are 1 to 5 ways)

What will be great to see is the frequency and phase response from 20 - 20.000 Hz - in one graph
 
+1(henrikbremerskov) just stereo in/out


just make it the same for user of the EQ (various RPi players) and DIY (cross overs).

input can be an identical signal with flat FR or measured FRD files
it would be great if it can load/show also off axis responses
 
Compile in VB, run/test on Pi? My target is Pi4 - nothing else really as I do not plan to ever get a MS OS

Cross-compilation is more complicated. If you have a decent SD card, you can try compiling natively on RPi4 - the first part of Kernel building - Raspberry Pi Documentation . First run without any changes, if the kernel compiles and boots OK, you can make the changes to usbl-audio sources, recompile (only corresponding modules will be rebuilt) and re-install modules.
 
Great! One thing, that is easy to overlook, is that the dacs and amplifiers get a much easier job when each channel only needs to handle a fraction of the frequency range. So you can get away with using cheaper dacs and amps, and the difference when upgrading to something better might not be that big.



Hello, I confirm this is efficient and works in my car. configuration, rock64, volumio, camilladsp, Asus u7, old amplifiers, 6 channels. I take this opportunity to thank all those who contribute to Camilla. Bernard,
 
Hi, I'm looking for a better solution for software volume control (ideally at the global level) and note that camilladsp is 64-bit float. I use Windows LTSC, which is my preference, but would consider linux.

I understand that a virtual soundcard can be set up to pass through to camilladsp. If this was arranged would it be possible to use a USB IR receiver and remote to control the volume in camilladsp? Thereby leaving windows volume set at 100% (i.e. bypassed).

Can max volume at startup be set for camilladsp?

Sorry - lots of questions!
 
Hi all,

i think i got camilla dsp working on my rock64 sbc. I connected my creative sound card. However when i run the configuration (2 to 4) i am getting the following error.

ERROR camilladsp - Playback error: ALSA function 'snd_pcm_hw_params_set_rate' failed with error 'EINVAL: Invalid argument'
INFO camillalib::alsadevice - Capture device supports rate adjust
INFO camillalib:😛rocessing - Playback thread has already stopped

my config file is below
Code:
--- 
devices:
  samplerate: 44100
  chunksize: 1024
  capture:
    type: Alsa
    channels: 2
    device: "hw:Loopback,0,0"
    format: S32LE
  playback:
    type: Alsa
    channels: 6
    device: "hw:S51"
    format: S32LE
    
mixers:
  to4chan:
    channels:
      in: 2
      out: 6
    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

filters:
  highpass2k:
    type: Biquad
    parameters:
      type: Highpass
      freq: 2000
      q: 0.707
  lowpass2k:
    type: Biquad
    parameters:
      type: Lowpass
      freq: 2000
      q: 0.707

pipeline:
  - type: Mixer
    name: to4chan
  - type: Filter
    channel: 2
    names:
      - highpass2k
  - type: Filter
    channel: 3
    names:
      - highpass2k
  - type: Filter
    channel: 0
    names:
      - lowpass2k
  - type: Filter
    channel: 1
    names:
      - lowpass2k
 
Last edited:
here is the list of devices hardware devices with the playback loop enabled

Code:
**** List of PLAYBACK Hardware Devices ****
card 0: rockchiprk3328 [rockchip,rk3328], device 0: ff000000.i2s-i2s-hifi i2s-hifi-0 [ff000000.i2s-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: rockchiprk3328 [rockchip,rk3328], device 1: ff010000.i2s-rk3328-hifi ff410000.codec-1 [ff010000.i2s-rk3328-hifi ff410000.codec-1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: rockchiprk3328 [rockchip,rk3328], device 2: ff030000.spdif-dit-hifi dit-hifi-2 [ff030000.spdif-dit-hifi dit-hifi-2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: S51 [SB X-Fi Surround 5.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: S51 [SB X-Fi Surround 5.1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Loopback [Loopback], device 0: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 2: Loopback [Loopback], device 1: Loopback PCM [Loopback PCM]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
 
katariat: You ask the alsa driver to use your SB X-Fi Surround 5.1 with 6 channels at 32bits at 44100Hz. IIRC your soundcard runs only USB full-speed with the linux driver, which has a packet size limit of 1023 bytes per one milisecond frame. However, your required data flow per ms is 44.1 * 4 * 6 = 1059 bytes.

That is one problem. Another problem is what modes your soundcard supports at USB full speed.

I will be quoting data from RPi4 no 5.1 audio with USB sound card - Bug Reports - LibreELEC Forum which should be the same soundcard. To check the speed, use command lsusb -t:

Code:
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 1: Dev 3, If 1, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 1: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 12M
        |__ Port 2: Dev 4, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 2: Dev 4, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
        |__ Port 3: Dev 5, If 0, Class=Audio, Driver=snd-usb-audio, [B]12M[/B]
        |__ Port 3: Dev 5, If 1, Class=Audio, Driver=snd-usb-audio, [B]12M[/B]
        |__ Port 3: Dev 5, If 2, Class=Audio, Driver=snd-usb-audio, [B]12M[/B]

12M speed listed for this soundcard. Now its capabilities are listed by lsusb -v . For 44100Hz (from the same zip file):

Code:
AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             3 (FORMAT_TYPE_III)
        [B]bNrChannels             2[/B]
        bSubframeSize           2
        [B]bBitResolution         16[/B]
        bSamFreqType            1 Discrete
        [B]tSamFreq[ 0]        44100[/B]

Only 2 channels and 16bits supported for 44100Hz. For 6 channels:

Code:
AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        [B]bNrChannels             6[/B]
        bSubframeSize           2
        [B]bBitResolution         16[/B]
        bSamFreqType            1 Discrete
        [B]tSamFreq[ 0]        48000[/B]

AudioStreaming Interface Descriptor:
        bLength                11
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        [B]bNrChannels             6[/B]
        bSubframeSize           3
        [B]bBitResolution         24[/B]
        bSamFreqType            1 Discrete
        [B]tSamFreq[ 0]        48000[/B]

Only 48kHz rate at 6ch, 16bits and 24bits supported. Quick check: 48 * 6 * 3 = 864 bytes per ms, well within the max packet size.

IMO your soundcard should work with samplerate 48000 and playback format S24LE3 in the camilla config.
 
@phofman Thanks for your response. when i changed the sample rate and the format and rum camilla dsp, it didnt throw any error so i am guessing its working.

I have another issue. I wanted to go headless in the step so i also installed shairport sync which converts my SBC to an airplay reciever. When i play music through air play, the music is coming out of the HDMI port and not the USB/ Creative sound card.

Is this a setting on the SBC or the shairport sync where i can default the music to the USB/ Soundcard. Thanks for all the help
 
after i changed the config file, i am still getting an error when i run camilla dsp


ALSA lib pcm_hw.c:1829🙁_snd_pcm_hw_open) Invalid value for card
2021-04-03 12:41:36.620 ERROR camilladsp - Capture error: ALSA function 'snd_pcm_open' failed with error 'ENODEV: No such device'
2021-04-03 12:41:36.621 ERROR camillalib:😛rocessing - Message channel error: receiving on a closed channel
 
Great! One thing, that is easy to overlook, is that the dacs and amplifiers get a much easier job when each channel only needs to handle a fraction of the frequency range. So you can get away with using cheaper dacs and amps, and the difference when upgrading to something better might not be that big.

But bear in mind that the noise from the amps is summed.
And when using high output eg 15inch pro speakers any peak in the freq response gives a peak in the noise....
But of cource you can play really,really loud
 
@phofman thanks again. I started making changes to the config file and pretty much confused myself after 6 to 8 attempts at changing things based on my limited/ flawed understanding.

posting some of the data from capture/ playback and my config file to see if you and others can help me nail the config file.

current error message that i am getting. Is there an issue when i specify 4 channels on a 6-7 channel card?

Code:
2021-04-03 19:53:45.541 ERROR camilladsp - Playback error: ALSA function 'snd_pcm_hw_params_set_channels' failed with error 'EINVAL: Invalid argument'
2021-04-03 19:53:45.785 ERROR camillalib::processing - Message channel error: receiving on a closed channel
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', src/processing.rs:38:37
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

output for capture (arecord -l)
Code:
**** List of CAPTURE Hardware Devices ****
card 0: rockchiprk3328 [rockchip,rk3328], device 1: ff010000.i2s-rk3328-hifi ff410000.codec-1 [ff010000.i2s-rk3328-hifi ff410000.codec-1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: S51 [SB X-Fi Surround 5.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

output for playback (aplay -l)
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: rockchiprk3328 [rockchip,rk3328], device 0: ff000000.i2s-i2s-hifi i2s-hifi-0 [ff000000.i2s-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: rockchiprk3328 [rockchip,rk3328], device 1: ff010000.i2s-rk3328-hifi ff410000.codec-1 [ff010000.i2s-rk3328-hifi ff410000.codec-1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: rockchiprk3328 [rockchip,rk3328], device 2: ff030000.spdif-dit-hifi dit-hifi-2 [ff030000.spdif-dit-hifi dit-hifi-2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: S51 [SB X-Fi Surround 5.1], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: S51 [SB X-Fi Surround 5.1], device 1: USB Audio [USB Audio #1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

my config file using the advised sample rate and format
Code:
--- 
devices:
  samplerate: 48000
  chunksize: 1024
  capture:
    type: Alsa
    channels: 2
    device: "hw:rockchiprk3328,1"
    format: S24LE3
  playback:
    type: Alsa
    channels: 4
    device: "hw:S51"
    format: S24LE3
    
mixers:
  to4chan:
    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

filters:
  highpass2k:
    type: Biquad
    parameters:
      type: Highpass
      freq: 2000
      q: 0.707
  lowpass2k:
    type: Biquad
    parameters:
      type: Lowpass
      freq: 2000
      q: 0.707

pipeline:
  - type: Mixer
    name: to4chan
  - type: Filter
    channel: 2
    names:
      - highpass2k
  - type: Filter
    channel: 3
    names:
      - highpass2k
  - type: Filter
    channel: 0
    names:
      - lowpass2k
  - type: Filter
    channel: 1
    names:
      - lowpass2k
 
Last edited:
But bear in mind that the noise from the amps is summed.
And when using high output eg 15inch pro speakers any peak in the freq response gives a peak in the noise....
But of cource you can play really,really loud

So control of the gain structure can be more critical.
For elemants with lower than 90 dB sensitivity its not a problem. Only for 100+ dB large elements, horns and other pro elements that has very high sensitivity in the midrange.
Like this: Proraum Vertriebs-GmbH | Shop | AUDAX PR330M0
 
Last edited:
Is there an issue when i specify 4 channels on a 6-7 channel card?

Data for alsa device called "hw:xxxx" are directly passed to the driver, no modifications along the path from the player to the driver. If your soundcard supports only 2ch and 6ch modes, request to open the device in 4ch mode is correctly refused - hence the error.

But you can configure your camilladsp mixer to use 6 channels instead of only 4 and open your soundcard in the 6ch mode.
 
@phofman thanks for your help once again. I changed the config file to be 6 channels and i think it ran successfully ....at least that's what i think. This is the message that i get

2021-04-04 13:47:27.939 INFO camillalib::alsadevice - Starting playback from Prepared state

here is the issue though...i still am not getting any sound from the sound card. When i run a speaker test the sound is coming out of the HDMI..which i think is the default for ALSA.

speaker-test -D hw:S51 -c6 -r48000 (sound toggles through the 6 channels but still comes through HDMI)

speaker-test -D hw:rockchiprk3328 -c2 -r48000 (sound toggles through the 2 channels but still comes through HDMI)

I also read a bit and saw an ALSA utility alsamixer than can allow you to select the sound card. I was able to see the Creative sound card, i did select it but it doesnt give me the option to save it. It reverts back to default which is the HDMI

Is there an option to change the default in Alsa to the sound card? Thanks