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

Dumb question. How do I make a merged LFE channel? do I simply have a mixer with merged channel 0 and 1 sources and reduce gain by 6dB to prevent clipping?

as per:

or... by applying the mixer BEFORE the gain reduction, I'm already clipping?

Code:
      - dest: 6
        # Subwoofer - send both chanels (unfiltered)
        mute: false
        sources:
          - channel: 0
          - channel: 1

...

  sw_gain:
    type: Gain
    parameters:
      gain: -6

...

  # LFE
  - type: Filter
    channel: 6
    names:
      - sw_delay
      - sw_gain
      - sw_lowpass
 
Hi,

I'm trying to resample to 176400 and then doing some FIR filtering. However, I've got massive clipping which I think is caused by the resampler.
I've already applied attenuation on the mixer to compensate for the FIR, so clipping is not caused by the FIR. CamillaDSP does not report any clipping too, so I'm pretty sure it's coming from the resampling. If I remove the resampling the clipping is gone but I'd like to do the processing on 176400. I'm using ALSA loopback or an external audio device (SPDIF hat) to feed CamillaDSP.
Is there any way to add attenuation on the input signal before doing resampling? It looks like loopback in ALSA mixer does not have any volume controls. Sorry if that has been already discussed.

Thanks,
Plamen
 
Hi,

I'm trying to resample to 176400 and then doing some FIR filtering. However, I've got massive clipping which I think is caused by the resampler.
I've already applied attenuation on the mixer to compensate for the FIR, so clipping is not caused by the FIR. CamillaDSP does not report any clipping too, so I'm pretty sure it's coming from the resampling. If I remove the resampling the clipping is gone but I'd like to do the processing on 176400. I'm using ALSA loopback or an external audio device (SPDIF hat) to feed CamillaDSP.
Is there any way to add attenuation on the input signal before doing resampling? It looks like loopback in ALSA mixer does not have any volume controls. Sorry if that has been already discussed.

Thanks,
Plamen
Can you use the softvol plugin via asound.conf on the loopback device for a static reduction? Or do you not want to involve ALSA plug ins for quality reasons?
 

TNT

Member
Joined 2003
Paid Member
Hi,

I'm trying to resample to 176400 and then doing some FIR filtering. However, I've got massive clipping which I think is caused by the resampler.
I've already applied attenuation on the mixer to compensate for the FIR, so clipping is not caused by the FIR. CamillaDSP does not report any clipping too, so I'm pretty sure it's coming from the resampling. If I remove the resampling the clipping is gone but I'd like to do the processing on 176400. I'm using ALSA loopback or an external audio device (SPDIF hat) to feed CamillaDSP.
Is there any way to add attenuation on the input signal before doing resampling? It looks like loopback in ALSA mixer does not have any volume controls. Sorry if that has been already discussed.

Thanks,
Plamen
Intersting - I was planning to do this myself - 384 and then a FIT filter to my liking. I use a Mac Mini... I will try it tomorrow... but keep track of the levels...

Is it per math that one need to do attenuation if doing upsampling? Should it really be necessary?

//
 
Can you use the softvol plugin via asound.conf on the loopback device for a static reduction? Or do you not want to involve ALSA plug ins for quality reasons?
Thanks for the idea, Dave. I don't have much experience with ALSA so I will get familiar first and then will try to configure it as suggested.
BTW, I'm using CamillaDSP under Volumio2. When I try to set the volume control to software mixer from menu, it fails with "Failed to open ALSA device "softvolume" - no such file or directory". I followed the example configuration from ALSA softvol but with no success.
https://alsa.opensrc.org/Softvol
As for now I would like to simply add the the attenuation, no matter ALSA plugins sound quality. Once I fix the clipping, and if not satisfied I can think of a better solution.
 
Hi,

I'm trying to resample to 176400 and then doing some FIR filtering. However, I've got massive clipping which I think is caused by the resampler.
How much clipping is this? Roughly how many cipped samples per second? The resampler should not increase the overall level, but it does create some inter-sample values that can go above the original signal.
 
How much clipping is this? Roughly how many cipped samples per second? The resampler should not increase the overall level, but it does create some inter-sample values that can go above the original signal.
Sorry, my fault. I was able to import one of the clipping tracks in Audacity and noticed that it is already clipped. I though that track is normalized very close to 0 dB and clipping is introduced by the resampler, but it looks like issue is not caused by the resampling or by CamillaDSP. However, for some reason clipping is not that audible if no resampling is done. After resampling it is very annoying and totally unlistenable. Never mind, will try to add some attenuation. Thank you for the great project and for your support!
 
  • Like
Reactions: 1 user
Sorry, my fault. I was able to import one of the clipping tracks in Audacity and noticed that it is already clipped. I though that track is normalized very close to 0 dB and clipping is introduced by the resampler, but it looks like issue is not caused by the resampling or by CamillaDSP. However, for some reason clipping is not that audible if no resampling is done. After resampling it is very annoying and totally unlistenable. Never mind, will try to add some attenuation. Thank you for the great project and for your support!
Maybe it is the chunksize? Yesterday I did some upsampling to 96k and with a very small chunksize of 256 I had severe distortion, with 512 things were working again. I am trying to minimise latency for best possible lip-sync while watching movies. If using no FIR filtering and upsampling, latency is bareble, but not perfect.
Are there some tricks to get minimal delay with camilladsp? There will always be some, I know, but maybe it can be better than what I have now. For the purpose of watching movies I use only IIR filtering, because with FIR delay is too much.
CDSP is running on a Mac mini with a topping DM7 as converter. Beautiful Combination, by the way.
 
Maybe it is the chunksize? Yesterday I did some upsampling to 96k and with a very small chunksize of 256 I had severe distortion,
That is a very small chunk size a 96k. Did you have distortion, or frequent buffer underruns?
Are there some tricks to get minimal delay with camilladsp?
Use IIR only (like you already do), Then you can play with the target_level and chunksize. If chunk size 512 works well, then use that and try to reduce target_level as far as it will go without giving buffer underpins.
 
That is a very small chunk size a 96k. Did you have distortion, or frequent buffer underruns?
I am not sure of the symptoms of a buffer underrun, but I experienced a permanent heavy distortion, sounded like a struggling computer, not able keep up with the necessary calculations, as would be expected. Even though the computer still had a lot of headroom (Camilladsp used around 12% of the available CPU cycles).
 
Yes, that's most likely buffer underruns. Chunksize 256 at 96kHz is 2.6ms, very tight timing. What is your audio chain?
My chain consists mostly of the Logitech media server with local squeezelite on the same Mac mini as camilladsp, sometimes Apple Music, Safari, Quicktime, VLC or Airplay routed through Black Hole to camilladsp into the Topping DM7 8 channel converter.
I was just experimenting with those chunksizes and upsampling for the sake of minimising latency, I tried if maybe at higher sample rates the latency could decrease because of the faster cycling, but I guess the upsampling process takes some time, too.
For critical listening I use FIR filters, the latency does not bother me.
Right now I use no upsampling and IIR filters with chunksize 64 while watching movies, I did not measure latency but it is good enough for now.
 
Is there a way to disable a filter in the pipeline? I'd like to be able to turn them on/off without removing them completely.
Not yet, but the next version adds a way to bypass filters.
@HenrikEnquist : Henrik, I tried to find where CDSP sets the some coreaudio buffer size (like alsa or wasapi periods), and found only this https://github.com/HEnquist/camilladsp/blob/master/src/coreaudiodevice.rs#L577 . You worked hard on the coreaudio details, please can you elucidate me/us on this? Thanks a lot!
Currently I don't set the buffer size for CoreAudio, just use whatever the system gives. Since then (after writing that comment) I learned that it's possible to request a size. I plan to use that to set the size depending on the camilladsp chunksize, just haven't had time to implement it yet.
 
  • Like
Reactions: 1 user

TNT

Member
Joined 2003
Paid Member
So I have this 96khz Fs tune that I'm trying to play. If I have C set to 44,1 it plays it fine but downsampled of course. If I set C to 96 it plays, but it sounds muffled. Lower band sound OK but all treble is gone. So sound is fine but like with a LP filter i.e not transposed or any other strange effect. All other involved resources (Soundflower, Digiface, SqueezePlayer) was aslo set to do 96. Current used set don't use any FIR.

Which of the filter types are Fs dependent?

//
 
So I have this 96khz Fs tune that I'm trying to play. If I have C set to 44,1 it plays it fine but downsampled of course. If I set C to 96 it plays, but it sounds muffled. Lower band sound OK but all treble is gone. So sound is fine but like with a LP filter i.e not transposed or any other strange effect. All other involved resources (Soundflower, Digiface, SqueezePlayer) was aslo set to do 96. Current used set don't use any FIR.

Which of the filter types are Fs dependent?

//

Are you using biquads where you specify the biquad coefficients directly? Biquad coefficients are Fs dependent.

Michael