henquist / camilladsp Goto Github PK
View Code? Open in Web Editor NEWA flexible cross-platform IIR and FIR engine for crossovers, room correction etc.
Home Page: https://henquist.github.io/
License: GNU General Public License v3.0
A flexible cross-platform IIR and FIR engine for crossovers, room correction etc.
Home Page: https://henquist.github.io/
License: GNU General Public License v3.0
..instead of the very short default one
I'm new to this sort of stuff, so the cause may just be a mis-configuration somewhere. But, I generated FIR filters using drc-fir (http://drc-fir.sourceforge.net/doc/drc.html), and when I try to use them, I'm getting more than a second of latency, the volume is extremely low, and audio sounds like it's coming from a cave. The same filters (converted to WAV files) worked as expected with Equalizer APO on a Windows VM.
OS: Ubuntu 18.04
Camilla DSP version: built 6b40746 with cargo build --release
---
devices:
samplerate: 44100
chunksize: 1024
silence_threshold: -61
silence_timeout: 3.0
capture:
type: Pulse
channels: 2
device: "MySink.monitor"
format: FLOAT32LE
playback:
type: Pulse
channels: 2
device: "alsa_output.pci-0000_00_1b.0.analog-stereo"
format: FLOAT32LE
filters:
l_drc:
type: Conv
parameters:
type: File
filename: /home/anonymous/synced/roomEQ/desktop/left441.pcm
format: FLOAT32LE
r_drc:
type: Conv
parameters:
type: File
filename: /home/anonymous/synced/roomEQ/desktop/right441.pcm
format: FLOAT32LE
pipeline:
- type: Filter
channel: 0
names:
- l_drc
- type: Filter
channel: 1
names:
- r_drc
pacmd load-module module-null-sink sink_name=MySink
./camilladsp ~/.camillaConfig
pacmd list-sinks
: index: 0
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra5>
driver: <module-alsa-card.c>
flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9030
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 0
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
card: 0 <alsa_card.pci-0000_01_00.1>
module: 7
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "HDMI 5"
alsa.id = "HDMI 5"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "11"
alsa.card = "1"
alsa.card_name = "HDA ATI HDMI"
alsa.long_card_name = "HDA ATI HDMI at 0xee360000 irq 41"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:01:00.1"
sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
device.bus = "pci"
device.vendor.id = "1002"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
device.product.id = "aac8"
device.product.name = "Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X]"
device.string = "hdmi:1,5"
device.buffering.buffer_size = "352768"
device.buffering.fragment_size = "176384"
device.access_mode = "mmap+timer"
device.profile.name = "hdmi-stereo-extra5"
device.profile.description = "Digital Stereo (HDMI 6)"
device.description = "Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X] Digital Stereo (HDMI 6)"
alsa.mixer_name = "ATI R6xx HDMI"
alsa.components = "HDA:1002aa01,00aa0100,00100500"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
hdmi-output-5: HDMI / DisplayPort 6 (priority 5400, latency offset 0 usec, available: yes)
properties:
device.icon_name = "video-display"
device.product.name = "ASUS VS228"
active port: <hdmi-output-5>
index: 1
name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9039
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 1
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 1837.50 ms
card: 1 <alsa_card.pci-0000_00_1b.0>
module: 8
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC1150 Analog"
alsa.id = "ALC1150 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xee410000 irq 40"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1b.0"
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "8ca0"
device.product.name = "9 Series Chipset Family HD Audio Controller"
device.form_factor = "internal"
device.string = "front:0"
device.buffering.buffer_size = "352800"
device.buffering.fragment_size = "176400"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "Built-in Audio Analog Stereo"
alsa.mixer_name = "Realtek ALC1150"
alsa.components = "HDA:10ec0900,18491151,00100001"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
analog-output-lineout: Line Out (priority 9900, latency offset 0 usec, available: yes)
properties:
analog-output-headphones: Headphones (priority 9000, latency offset 0 usec, available: no)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-lineout>
* index: 2
name: <MySink>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 12 KiB
max rewind: 12 KiB
monitor source: 3
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 1
configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
module: 30
properties:
device.description = "Null Output"
device.class = "abstract"
device.icon_name = "audio-card"
pacmd list-sources
: index: 0
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo-extra5.monitor>
driver: <module-alsa-card.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 1030
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 0 KiB
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
monitor_of: 0
card: 0 <alsa_card.pci-0000_01_00.1>
module: 7
properties:
device.description = "Monitor of Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X] Digital Stereo (HDMI 6)"
device.class = "monitor"
alsa.card = "1"
alsa.card_name = "HDA ATI HDMI"
alsa.long_card_name = "HDA ATI HDMI at 0xee360000 irq 41"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:01:00.1"
sysfs.path = "/devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card1"
device.bus = "pci"
device.vendor.id = "1002"
device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
device.product.id = "aac8"
device.product.name = "Hawaii HDMI Audio [Radeon R9 290/290X / 390/390X]"
device.string = "1"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
* index: 1
name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
driver: <module-alsa-card.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 1030
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 0 KiB
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 1837.50 ms
monitor_of: 1
card: 1 <alsa_card.pci-0000_00_1b.0>
module: 8
properties:
device.description = "Monitor of Built-in Audio Analog Stereo"
device.class = "monitor"
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xee410000 irq 40"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1b.0"
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "8ca0"
device.product.name = "9 Series Chipset Family HD Audio Controller"
device.form_factor = "internal"
device.string = "0"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
index: 2
name: <alsa_input.pci-0000_00_1b.0.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9039
volume: front-left: 20726 / 32% / -30.00 dB, front-right: 20726 / 32% / -30.00 dB
balance 0.00
base volume: 6554 / 10% / -60.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 0 KiB
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
card: 1 <alsa_card.pci-0000_00_1b.0>
module: 8
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC1150 Analog"
alsa.id = "ALC1150 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0xee410000 irq 40"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1b.0"
sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "8ca0"
device.product.name = "9 Series Chipset Family HD Audio Controller"
device.form_factor = "internal"
device.string = "front:0"
device.buffering.buffer_size = "352800"
device.buffering.fragment_size = "176400"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "Built-in Audio Analog Stereo"
alsa.mixer_name = "Realtek ALC1150"
alsa.components = "HDA:10ec0900,18491151,00100001"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
analog-input-front-mic: Front Microphone (priority 8500, latency offset 0 usec, available: no)
properties:
device.icon_name = "audio-input-microphone"
analog-input-rear-mic: Rear Microphone (priority 8200, latency offset 0 usec, available: no)
properties:
device.icon_name = "audio-input-microphone"
analog-input-linein: Line In (priority 8100, latency offset 0 usec, available: no)
properties:
active port: <analog-input-front-mic>
index: 3
name: <MySink.monitor>
driver: <module-null-sink.c>
flags: DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 1000
volume: front-left: 65536 / 100% / 0.00 dB, front-right: 65536 / 100% / 0.00 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max rewind: 12 KiB
sample spec: s16le 2ch 44100Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
monitor_of: 2
module: 30
properties:
device.description = "Monitor of Null Output"
device.class = "monitor"
device.icon_name = "audio-input-microphone"
...the sample correction files output the correction filter (rps.pcm) in 32 bit floating point format normalized to 1.0...
The project is one of the best documented DSP I found (congrats!) so it would be perfect to use in simple active crossovers. The one thing I couldn't find in the repository is the minimal hardware configuration. Is it possible to run the software on raspberry pi 2/3/4/0 and have reasonable delay?
should process one waveform based on a control input from another channel
I have a config with a negative peaking filter.
With the filter I get severe clipping:
Dec 20 01:11:25.059 WARN Clipping detected, 12 samples clipped, peak 128.92933791033744%, module: camillalib::conversions
I think, this should not be possible.
Without the filter there is no clipping.
This happened on the HDMI output of my Raspi 3B.
I had to set the ALSA volume for the HDMI output to 0dB, otherwise also the config without the filter would clip: amixer -c 0 sset "HDMI",0 -- 0dB
Here is the complete config:
devices:
samplerate: 44100
chunksize: 1024
queuelimit: 2
capture:
type: Stdin
channels: 2
format: S16LE
playback:
type: Alsa
channels: 2
device: "hw:0"
format: S16LE # supported formats are: S16LE
filters:
L1:
type: Biquad
parameters:
type: Peaking
freq: 100
q: 1
gain: -10
pipeline:
- type: Filter
channel: 0
names:
- L1
Hi Henrik,
I´ve used version 0.0.14 for a while, now I gave a try to version 0.4, but I´ve got this message:
camilladspNEW: /lib/x86_64-linux-gnu/libm.so.6: version 'GLIBC_2.29' not found (required by camilladspNEW)
It´s a linux thing, I know... any easy fix in mind?
Thank you in advance & kind regards!
Jo
first-order shelf filter of the form (1+sT1)/(1+sT2)
I want to use moodeaudio 7.1 beta, had a lot of discussion with user bitlab, but we do not find any mistake why it is not working.
I have coefficient files form Audiovero called acourate.
Audio Format : PCM Format profile : Float Codec ID : 3 Codec ID/Hint : IEEE Duration : 682 ms Bit rate mode : Constant Bit rate : 49.2 Mb/s Channel(s) : 2 channels Sampling rate : 384 kHz Bit depth : 64 bits Stream size : 4.00 MiB (100%)
My DAC is switching constantly between 44,1 and the sampling frequency of the file with no sound.
The yaml file should be correct, a flat file is running correctly.
I also tried to save the wav file in Audacity as 32 float and 24 int file, but no success.
Hope you have an idea.
BR
Erich
Cor1S384000.zip
Defining the same filter/mixer name more than once should give an error
Allow loading arbitrary LV2, LPDSPA (or VST, but the API is proprietary to my understanding) modules as camiliadsp filters.
In different formats, same as for audio devices
I would like to integrate a config check into the UI of a web app (Webinterface of Moode Audio).
For that it would be nice, if the output of CamillaDSPs --check
command would be nicer.
Running camilladsp -c invalid.yml
results in return code 0 (indicating everything went fine) and the output:
2020-12-06 02:49:19.486 ERROR camilladsp - Invalid config file!
while parsing a block mapping, did not find expected key at line 3 column 3
What I would like to see is return code >0 and output:
Invalid config file!
while parsing a block mapping, did not find expected key at line 3 column 3
Dear Henrik,
I´m a happy user of your CamillaDSP, running it on a 24/7 headless Debian / Intel system.
For my usecase it would be greate to have a proper systemd init configuration, to start Camilla DSP as a service without any manual interference.
Any chance? Thank you in advance!
kr
jo
rely on websocket server for all configuration
Don't always write a full chunk for the last one in a file
Continuation from: #88
Play a flac song using mpd using blackhole and camilladsp as the output. 44.1kHz flacs will be choppy, 48kHz songs won't produce any sound at all.
Interestingly, when there is a YouTube video playing in the background (even muted), the choppyness will be gone. Also when the following setting screen is open the choppyness will be gone, I'm not sure as to why? Maybe it creates a 48kHz stream like a YouTube video does:
Also interesting is that playing a 48kHz song in mpd will kill other streams (such as youtube audio) as well.
Mac Mini M1
Big Sur 11.2
The input and output of BlackHole are both set to 44.1kHz, 2ch 32 bit float
, the output of my dac is set to 2ch 16-bit interger, 44.1kHz
, these are all the default values, and I didn't tinker with them.
---
devices:
samplerate: 44100
chunksize: 1024
capture:
type: CoreAudio
channels: 2
device: "BlackHole 2ch"
format: FLOAT32LE
playback:
type: CoreAudio
channels: 2
device: "DAC01"
format: FLOAT32LE
filters:
gain_500:
type: Biquad
parameters:
type: Peaking
freq: 500
q: 1.0
gain: -2.0
gain_2000:
type: Biquad
parameters:
type: Peaking
freq: 2000
q: 1.0
gain: -1.0
gain_4000:
type: Biquad
parameters:
type: Peaking
freq: 4000
q: 1.0
gain: -5.0
gain_8000:
type: Biquad
parameters:
type: Peaking
freq: 8000
q: 1.0
gain: 5.0
gain_16000:
type: Biquad
parameters:
type: Peaking
freq: 16000
q: 1.0
gain: 1.0
mixers:
mono:
channels:
in: 2
out: 2
mapping:
- dest: 0
sources:
- channel: 0
gain: -6.0
inverted: false
- dest: 1
sources:
- channel: 1
gain: -6.0
inverted: false
pipeline:
- type: Mixer
name: mono
- type: Filter
channel: 0
names:
- gain_500
- gain_2000
- gain_4000
- gain_8000
- gain_16000
- type: Filter
channel: 1
names:
- gain_500
- gain_2000
- gain_4000
- gain_8000
- gain_16000
I've just started exploring camilladsp after having spent a few days reacquainting myself with brutefir. I uses brutefir with Logitech Media Server and squeezelite. It is working quite well and I was thinking of re-writing the DRC script for camllladsp.
In my first tests I've found that simple pipe-in pipe-out processing works, but only for S16LE to S16LE.
On linux:
cat 16-bit.pcm | camilla 16-bit.config > 16-bit.raw # works fine.
If the config changes either stdin or stdout to S24LE, the output is bad - very clipped, not music.
Interesting observation: 16->24 gives a shorter output file (ratio 16:24); 24-16 gives a longer output file, 24->24 is correct size.
(The feature set and configuration possibilities of camilladsp look very good for use on a linux box!)
Hello,
Was testing out your conversion method using both sox and audacity and keep getting the following error when trying to load the coeffs .raw file. When I export as text in audacity the text files work fine.
Invalid filter 'Convolver_L'. Reason: Can't read line 1 of file '/home/pi/camilladsp/coeffs/6_L_32LE.raw'. Error: stream did not contain valid UTF-8
I have used both the current and develop versions with the same issue., I have included the .raw and text versions of the file as well for review if needed.
Thanks in advance, Yvon. (CamillaDSP: 0.5.0; pyCamillaDSP: 0.5.0; Backend: 0.6.0; Debian Buster - PI3)
Convolver_file.zip
One vector for nominator, one for denominator, both optional
I just noticed, that silence_threshold
and silence_timeout
are not validated.
This is not essential, but easy to fix.
AFAIK silence_threshold
should be a number <= 0
and silence_timeout
should be a number >= 0
While trying the new support of wave files (with camilladsp-0.5.0-linux-armv7.tar.gz) I have an issue with checking the config.
Normally I use this wave file as test for the moOde convertion function.
Which format of wave files are suported/tested ?
Output of the check:
pi@moodep4:/usr/share/camilladsp/configs $ camilladsp -c testwav.yml
Config is not valid
Invalid filter 'ir_left'. Reason: Cant read channel 0 of file '/usr/share/camilladsp/coeffs/Cor1S44.wav' which contains 0 channels.
mediainfo about the used wave files:
pi@moodep4:/usr/share/camilladsp/configs $ mediainfo /usr/share/camilladsp/coeffs/Cor1S44.wav
General
Complete name : /usr/share/camilladsp/coeffs/Cor1S44.wav
Format : Wave
File size : 1.00 MiB
Duration : 1 s 486 ms
Overall bit rate mode : Constant
Overall bit rate : 5 646 kb/s
Recorded date : 1/27/2021
Writing application : Unknown
Audio
Format : PCM
Format profile : Float
Codec ID : 3
Codec ID/Hint : IEEE
Duration : 1 s 486 ms
Bit rate mode : Constant
Bit rate : 5 645 kb/s
Channel(s) : 2 channels
Sampling rate : 44.1 kHz
Bit depth : 64 bits
Stream size : 1.00 MiB (100%)
configuration fragment:
filters:
ir_left:
parameters:
channel: 0
filename: /usr/share/camilladsp/coeffs/Cor1S44.wav
type: Wav
type: Conv
ir_right:
parameters:
channel: 1
filename: /usr/share/camilladsp/coeffs/Cor1S44.wav
type: Wav
type: Conv
Dear Henrik,
CamillaDSP seems to be the perfect solution for my Debian-Mopidy-Spotify-Convolution player! But during installation process I´ve got the following error. I´m not sure if this is Camilla-related or anything else:
Compiling libpulse-sys v1.12.1
Compiling alsa-sys v0.2.0
Compiling libc v0.2.67
Compiling num-traits v0.2.11
Compiling num-integer v0.1.42
error: failed to run custom build command for `alsa-sys v0.2.0`
Caused by:
process didn't exit successfully: `/root/camilladsp/target/release/build/alsa-sys-d93d0507f6b2b18a/build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Failed to run `"pkg-config" "--libs" "--cflags" "alsa"`: No such file or directory (os error 2)', /root/.cargo/registry/src/github.com-1ecc6299db9ec823/alsa-sys-0.2.0/build.rs:13:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
Kind regards!
Josef
If wait mode is enabled, it goes back to waiting for a new config instead of exiting
First and foremost my sincere congratulations for this DSP project. It is absolutely remarkable!
I experience an issue though. To test Camilla properly, I made a simple stereo in to stereo out pipeline without any processing
`
devices:
samplerate: 96000
chunksize: 1024
capture:
type: Alsa
channels: 2
device: "hw:0,0"
format: S16LE
playback:
type: Alsa
channels: 2
device: "hw:0,0"
format: S16LEmixers:
stereo:
channels:
in: 2
out: 2
mapping:
- dest: 0
sources:
- channel: 0
gain: -6
inverted: false
- dest: 1
sources:
- channel: 1
gain: -6
inverted: falsepipeline:
- type: Mixer
name: stereo
`
This works fine without any issues.
But is I change S16_LE to S24_LE, like this:
`---
devices:
samplerate: 96000
chunksize: 1024
capture:
type: Alsa
channels: 2
device: "hw:0,0"
format: S24LE
playback:
type: Alsa
channels: 2
device: "hw:0,0"
format: S24LEmixers:
stereo:
channels:
in: 2
out: 2
mapping:
- dest: 0
sources:
- channel: 0
gain: -6
inverted: false
- dest: 1
sources:
- channel: 1
gain: -6
inverted: falsepipeline:
- type: Mixer
name: stereo
`
I get very strong distortion and clipping occurring as if the process is trying to read 24bit info as only the lower 16bits, or some similar kind of bit shift causing massive clipping.
I've tried to debug the capabilities of my interface by using:
arecord -c 2 -f S24_LE -r 96000 | aplay -c 2 -f S24_LE -r 96000
Basically piping arecord into aplay at 96/24. This worked fine without any distortion. By which I assume my interface is S24_LE capable on both ends.
My setup is:
Raspberry Pi 4, raspberry Pi OS
uname -a:
Linux audioRpi4 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l GNU/Linux
camilladsp -V
CamillaDSP 0.5.0-beta6
Audio interface:
HifiBerry Digi+ I/O using ALSA over I2S
Source signal is coming over SPDIF from an RME Fireface 400 interface set to 96KHz samplerate.
Anyway of figuring out where the distortion is coming from?
When using a raw S24LE3 file as ir I get a strange distorted sound. It sounds a little bit the same as wrong selected format. The config has a gain filter infront of the fir filter to reduce the output.
Do you know if S24LE3 works correct ?
The raw file is based on wav with the following settings:
Input File : 'test.wav'
Channels : 1
Sample Rate : 44100
Precision : 24-bit
Duration : 00:00:00.50 = 22050 samples = 37.5 CDDA sectors
File Size : 66.2k
Bit Rate : 1.06M
Sample Encoding: 24-bit Signed Integer PCM
I have create the raw (S24LE3) file with sox:
sox test.wav test_44100Hz_24b.raw ( or sox test.wav -b 24 test_44100Hz_24b.raw)
If I convert the 24bits file to 16 (S16LE)or 32(S32LE) bits everything sounds fine:
sox test.wav -b 16 test_44100Hz_16b.raw
sox test.wav -b 32 test_44100Hz_32b.raw
I have included the ir files in the attached zip:
test_ir.zip
I am fairly sure this is a camilladsp problem? Setup is MacOS with BlackHole and then CamillaDSP for some audio-filters. Playing music through MPD, sometimes when the song changes, audio output stops till I restart camilladsp or change again to some other song. The good thing is that it always happens with the same songs, so in that way it is reproducible.
I think it might have something to do with different sample rates? In the following example I change from the working song to the not working song and back again (which fixes the output).
Song 1: 36 - 崖の上のポニョ (映画バージョン).flac: FLAC audio bitstream data, 16 bit, stereo, 44.1 kHz, 4248300 samples
Song 2: 01 - ドライヴ.flac: FLAC audio bitstream data, 24 bit, stereo, 96 kHz, 22739334 samples
Logs:
May 30 13:28:27.075 DEBG Opened CPAL playback device DAC01, module: camillalib::cpaldevice
May 30 13:28:27.075 DEBG Playback thread ready to start, module: camilladsp
May 30 13:28:27.075 TRCE Build f32 output stream, module: camillalib::cpaldevice
May 30 13:28:27.077 DEBG Opened CPAL capture device BlackHole 2ch, module: camillalib::cpaldevice
May 30 13:28:27.077 TRCE Build f32 input stream, module: camillalib::cpaldevice
May 30 13:28:27.077 DEBG Capture thread ready to start, module: camilladsp
May 30 13:28:27.077 DEBG Both capture and playback ready, release barrier, module: camilladsp
May 30 13:28:27.113 TRCE f32 input stream ready, module: camillalib::cpaldevice
May 30 13:28:27.236 TRCE f32 output stream ready, module: camillalib::cpaldevice
May 30 13:28:27.236 DEBG Starting playback loop, module: camillalib::cpaldevice
May 30 13:28:27.236 DEBG Starting capture loop, module: camillalib::cpaldevice
May 30 13:28:28.251 TRCE Measured sample rate is 44386.569176240984 Hz, module: camillalib::cpaldevice
May 30 13:28:29.273 TRCE Measured sample rate is 44101.11351709622 Hz, module: camillalib::cpaldevice
May 30 13:28:30.295 TRCE Measured sample rate is 44096.77390151384 Hz, module: camillalib::cpaldevice
May 30 13:28:31.316 TRCE Measured sample rate is 44097.705442803344 Hz, module: camillalib::cpaldevice
May 30 13:28:32.338 TRCE Measured sample rate is 44101.122495722615 Hz, module: camillalib::cpaldevice
# I change the song here
May 30 13:28:32.855 WARN Playback interrupted, no data available, module: camillalib::cpaldevice
# I change the song back
May 30 13:28:38.214 TRCE Measured sample rate is 3833.471527418081 Hz, module: camillalib::cpaldevice
May 30 13:28:38.215 INFO Restarting playback after buffer underrun, module: camillalib::cpaldevice
May 30 13:28:39.236 TRCE Measured sample rate is 44095.23287059874 Hz, module: camillalib::cpaldevice
May 30 13:28:40.258 TRCE Measured sample rate is 44107.404113434415 Hz, module: camillalib::cpaldevice
May 30 13:28:41.280 TRCE Measured sample rate is 44096.274008421475 Hz, module: camillalib::cpaldevice
May 30 13:28:42.301 TRCE Measured sample rate is 44103.06869927258 Hz, module: camillalib::cpaldevice
May 30 13:28:43.323 TRCE Measured sample rate is 44099.511020342616 Hz, module: camillalib::cpaldevice
May 30 13:28:44.344 TRCE Measured sample rate is 44104.138959949014 Hz, module: camillalib::cpaldevice
May 30 13:28:45.366 TRCE Measured sample rate is 44097.92124282349 Hz, module: camillalib::cpaldevice
May 30 13:28:46.388 TRCE Measured sample rate is 44097.17134683605 Hz, module: camillalib::cpaldevice
May 30 13:28:47.410 TRCE Measured sample rate is 44100.4642167007 Hz, module: camillalib::cpaldevice
May 30 13:28:48.431 TRCE Measured sample rate is 44100.313139042104 Hz, module: camillalib::cpaldevice
May 30 13:28:49.453 TRCE Measured sample rate is 44102.4499049917 Hz, module: camillalib::cpaldevice
May 30 13:28:50.475 TRCE Measured sample rate is 44099.352740989714 Hz, module: camillalib::cpaldevice
May 30 13:28:51.496 TRCE Measured sample rate is 44099.22687799018 Hz, module: camillalib::cpaldevice
May 30 13:28:52.518 TRCE Measured sample rate is 44097.64247275553 Hz, module: camillalib::cpaldevice
May 30 13:28:53.540 TRCE Measured sample rate is 44104.89811627085 Hz, module: camillalib::cpaldevice
May 30 13:28:54.561 TRCE Measured sample rate is 44096.667819480295 Hz, module: camillalib::cpaldevice
May 30 13:28:55.583 TRCE Measured sample rate is 44100.30774343058 Hz, module: camillalib::cpaldevice
May 30 13:28:56.605 TRCE Measured sample rate is 44100.16745799449 Hz, module: camillalib::cpaldevice
May 30 13:28:57.626 TRCE Measured sample rate is 44096.26861379827 Hz, module: camillalib::cpaldevice
May 30 13:28:58.648 TRCE Measured sample rate is 44107.015507841046 Hz, module: camillalib::cpaldevice
May 30 13:28:59.670 TRCE Measured sample rate is 44099.81135281893 Hz, module: camillalib::cpaldevice
May 30 13:29:00.691 TRCE Measured sample rate is 44096.72897411349 Hz, module: camillalib::cpaldevice
May 30 13:29:01.713 TRCE Measured sample rate is 44103.1874178947 Hz, module: camillalib::cpaldevice
May 30 13:29:02.735 TRCE Measured sample rate is 44099.38153074111 Hz, module: camillalib::cpaldevice
May 30 13:29:03.756 TRCE Measured sample rate is 44099.14953044017 Hz, module: camillalib::cpaldevice
May 30 13:29:04.778 TRCE Measured sample rate is 44096.29916896151 Hz, module: camillalib::cpaldevice
May 30 13:29:05.800 TRCE Measured sample rate is 44099.28622688021 Hz, module: camillalib::cpaldevice
May 30 13:29:06.821 TRCE Measured sample rate is 44102.54526569656 Hz, module: camillalib::cpaldevice
May 30 13:29:07.843 TRCE Measured sample rate is 44093.145348578364 Hz, module: camillalib::cpaldevice
May 30 13:29:08.865 TRCE Measured sample rate is 44110.18392255949 Hz, module: camillalib::cpaldevice
May 30 13:29:09.886 TRCE Measured sample rate is 44096.12114688964 Hz, module: camillalib::cpaldevice
May 30 13:29:10.908 TRCE Measured sample rate is 44098.26829684557 Hz, module: camillalib::cpaldevice
May 30 13:29:11.930 TRCE Measured sample rate is 44103.10824329536 Hz, module: camillalib::cpaldevice
May 30 13:29:12.952 TRCE Measured sample rate is 44095.73455263494 Hz, module: camillalib::cpaldevice
May 30 13:29:13.973 TRCE Measured sample rate is 44101.433685085954 Hz, module: camillalib::cpaldevice
May 30 13:29:14.995 TRCE Measured sample rate is 44101.046954508805 Hz, module: camillalib::cpaldevice
Similar to alsaloudness, but done as a camiliadsp internal filter.
Two parameters are required: the reference level (in phon) and the desired attenuation (or boost, if positive) in dB/LU. The actual EQ curve is the difference between the two contours.
Dear Henrik,
I`m using different sources (different sample rates too), so resampling is a necessity to apply filters (FIR) without changing the filter files frequently.
Is the following audio pipeline possible? How to setup?
various (changing from song to song) sampling rates in from ALSA capture loop -> “automatic” resampling to target (fixed) sampling rate -> filters (FIR and others) -> Target (fixed) sample rate out to ALSA Playback loop?
In such a setup just one filter setup could be used, no filter switching needed. Setup should then avoid resampling in ALSA (I have to find out how, but should be possible).
Kind regards!
Josef, a 24/7 user of CamillaDSP
Rust 1.49 should support it now from what I understand: https://maconarm.com/app/rust
In order to catch as many errors as possible while creating the config and to prevent debugging (possibly on a remote machine) as much as possible,
I would like to have a stronger version of --check
that also checks that:
The old --check
should probably stay as it is, as just checking the config for syntax validity probably also has its use-cases.
I would like to be able to put my config and filters in one folder and reference the filter files relative to the config file.
E.g.:
filters:
fir:
type: Conv
parameters:
type: File
filename: filter.txt
format: TEXT
Currently, one has to use absolute paths or paths relative to the current working dir (usually not the config dir).
Thus moving the files together or renaming the parent directory breaks the config.
Also, when one wants to build and test filters on one PC and then transfer and run them on another machine (e.g. Raspberry Pi), the same folder structure on both machines is necessary.
It seems that validation via websocket is different from validation via command line.
The following config/coeff files are valid via command line but invalid when checked via the web interface (which uses the web socket for validation).
broken-validation.txt
Filter-44100-2.txt
I think this config should also be valid via websocket.
for limiters, compressors etc
I just implemented the mute options for gain filter and mixer mappings/sources on the develop branch of camillagui and noticed, that all the mute options behave strangely when applied during playback.
Mute on gain filter:
Most of the times, this does not change anything, when applied during playback.
When I restart CDSP, everything works as expected (correctly muted/unmuted).
Mute on Mixer Mappings & Sources:
This happens only with resamplers enabled - I tried sync and fast async.
The behavior is similar between source and destination channels.
Muting individual channels works fine.
However, when all channels are muted, the last channels that were not muted, play a strange noise.
For example, on a stereo setup, muting destination channel 0 works fine. Then muting channel 1 gives strange noise on channel 1. If both channels were unmuted and both are muted at the same time, the noise is on both channels. Unmuting one channel, removes the noise from all channels.
My config:
devices:
adjust_period: 3
capture:
channels: 2
device: CamillaDSP.monitor
format: S16LE
type: Pulse
capture_samplerate: 44100
chunksize: 1024
enable_rate_adjust: false
enable_resampling: true
playback:
channels: 2
device: alsa_output.pci-0000_00_1f.3.iec958-stereo
format: S32LE
type: Pulse
queuelimit: 4
resampler_type: Synchronous
samplerate: 44100
silence_threshold: 0
silence_timeout: 0
target_level: 1024
filters:
Gain:
parameters:
gain: 0
inverted: false
mute: false
type: Gain
mixers:
New Mixer 1:
channels:
in: 2
out: 2
mapping:
- dest: 0
mute: false
sources:
- channel: 0
gain: -1
inverted: false
mute: false
- dest: 1
mute: false
sources:
- channel: 1
gain: -1
inverted: false
mute: false
pipeline:
- name: New Mixer 1
type: Mixer
- channel: 0
names:
- Gain
type: Filter
- channel: 1
names:
- Gain
type: Filter
sudo killall -s SIGHUP camilladsp
kills the CDSP process, when invoked as camilladsp -p 1234 -w
.
When it is invoked via camilladsp -p 1234 config.yml
it will keep running.
This is currently an issue in moOde, because the SIGHUP is sent to all CDSP processes when the config changes. Then the backup CDSP (for offline use) of camillagui-backend terminates.
This could also be fixed by having camillagui-backend restart the internal CDSP process, if it went down. However, I would prefer fixing it here.
Hello,
first of all: this project is very interesting! I knew about it on diyaudio.com.
I tried to compile it on a volumio installation over a futro (a headless pc). Volumio is updated and i followed your guide for installation (pkg-config, alsa and pulseaudio dependecies) but after "cargo install --release" i've got:
Compiling libpulse-sys v1.12.1 error: failed to run custom build command for
libpulse-sys v1.12.1`
Caused by:
process didn't exit successfully: /home/volumio/Downloads/camilladsp/target/release/build/libpulse-sys-49ca079bb0973535/build-script-build
(exit code: 1)
--- stderr
"pkg-config" "--libs" "--cflags" "libpulse" "libpulse >= 12.0"
did not exit successfully: exit code: 1
--- stderr
Requested 'libpulse >= 12.0' but version of libpulse is 5.0
`
I checked the version of libpulse and it is 5.0. I tried to update but it's the newest under Volumio.
Could you please help me? Thank you.
Hi!
I am using an RME PCIe HDSPe AES audio card on Ubuntu (x86_64).
I've had excellent results with camilladsp on a different platform before, but I now need more I/O, so opted for this card.
From the commandline (Aplay, alsaloop, speakertest,...) it all works fine, but whatever I try with Camilladsp, I always get
Playback error: ALSA function 'snd_pcm_hw_params' failed with error 'EBUSY: Device or resource busy', module: camilladsp
here is an example of my config:
devices:
samplerate: 48000
chunksize: 1024
capture:
type: Alsa
channels: 2
device: "plughw:CARD=HDSPMx7423ee,DEV=0"
format: S16LE
playback:
type: Alsa
channels: 2
device: "plughw:CARD=HDSPMx7423ee,DEV=0"
format: S16LEmixers:
stereo:
channels:
in: 2
out: 2
mapping:
- dest: 0
sources:
- channel: 0
gain: 0
inverted: false
- dest: 1
sources:
- channel: 1
gain: 0
inverted: falsepipeline:
- type: Mixer
name: stereo
And here the output of aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
samplerate
Rate Converter Plugin Using Samplerate Library
speexrate
Rate Converter Plugin Using Speex Resampler
jack
JACK Audio Connection Kit
oss
Open Sound System
pulse
PulseAudio Sound Server
upmix
Plugin for channel upmix (4,6,8)
vdownmix
Plugin for channel downmix (stereo) with a simple spacialization
default
sysdefault:CARD=HDSPMx7423ee
RME AES32_7423ee, RME AES32
Default Audio Device
dmix:CARD=HDSPMx7423ee,DEV=0
RME AES32_7423ee, RME AES32
Direct sample mixing device
dsnoop:CARD=HDSPMx7423ee,DEV=0
RME AES32_7423ee, RME AES32
Direct sample snooping device
hw:CARD=HDSPMx7423ee,DEV=0
RME AES32_7423ee, RME AES32
Direct hardware device without any conversions
plughw:CARD=HDSPMx7423ee,DEV=0
RME AES32_7423ee, RME AES32
Hardware device with all software conversions
usbstream:CARD=HDSPMx7423ee
RME AES32_7423ee
USB Stream Output
I've tried searching around, but couldn't find relevant info. Tried every possible combination of ALSA devices and formats in Camilla. but keep encountering the same issue.
Any ideas?
Many thanks,
Alex
You can somewhat use camilladsp with JACK as it is, using alsa_in/alsa_out and a loopback ALSA device. However, there is a lot of back-and-forth and a lot of resampling going on, so this is not very good.
Having camilladsp more tightly integrated with JACK enables applications to measure the exact latency to physical hardware (which cannot be done with pure ALSA when a loopback is used), which is critical for accurate synchronisation of sound with other events (like graphics on a screen).
Hi,
Your work is great, and free. There is only one problem: I don't know how to donate 👎
Can you do something about it plz ? Thanks !
And continue the good work 👍 🥇
Hi Henrik,
on my RPI 3B when using sampling rates above 48kHz, there were frequent stutters due to buffer underruns.
It took me a while to realize that with each doubling of the sampling rate, I also had to double the chunk_size to get steady playback.
At least with ALSA output devices, the chunk_size seems to directly correlate with the sound card output buffer - I assume this is true for all hardware output devices.
I thought, you might want to include this information in the documentation to save some people the trouble - and maybe also yourself having to help them troubleshoot.
Add a few more filters, speific ones for each sample rate etc. Can be taken from sox.
hello!
I just saw your work and it seems promising!
I wrote a plugin using brutefir for Volumio https://volumio.org/volumio-overview/
My plugin : https://github.com/balbuze/volumio-plugins/tree/master/plugins/audio_interface/brutefir3
I'm going to give a try with Camilladsp now!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.