Filtering and softclip in transducers plugin

Post Reply
fdenk
Posts: 5
Joined: Wed Jan 11, 2023 8:38 am

Filtering and softclip in transducers plugin

Post by fdenk » Wed Jan 11, 2023 9:26 am

Hi,
something I have been wondering about the transducers plugin: What is the order in which FIR filtering and softclip are executed? I did not find anything about this in the documentation and not sure whether I read the c++ file corretly that filtering is done prior to clipping.

nmichael
Posts: 16
Joined: Thu Nov 18, 2021 1:44 pm

Re: Filtering and softclip in transducers plugin

Post by nmichael » Tue Jan 17, 2023 2:23 pm

Whoops, just realized you were asking a different question! Sorry about that. My answer below doesn't apply.
It's a good question though.

--------------------------------------------------------------------------------------------

Florian, I'm not that familiar with the code, but the way I think it works is with 2 parallel signal paths. The first path calculates a gain using the 'attack' and 'decay' filters to measure the signal power. The attack filter is a simple lowpass, the decay filter is a 'maxtracker':

input --> absolute value() ---> attack filter() ---> decay filter ---> signal power

Then, if the signal power is greater than the 'threshold', a gain is applied to the original input signal in order to limit the output. This gain is calculated one of two ways, linear or log.

So, the signal output doesn't really go through the filtering, the filtering is used to calculate a limiting gain.

nmichael
Posts: 16
Joined: Thu Nov 18, 2021 1:44 pm

Re: Filtering and softclip in transducers plugin

Post by nmichael » Tue Jan 17, 2023 4:02 pm

After going through the code and running some tests, I think the FIR filtering is done first, then the soft clipper.

I turned on the soft clipper and set the threshold so I could see the clipping in the In/Out curve (No FIR). Then, I kept the same threshold for clipping and set the FIR filter to [0.05 0 0], so huge attenuation to the output signal. When I measured the In/Out curve there wasn't any indication of limiting in the shape. If the signal went through the soft clipper first, I would expect to see an attenuated version of the 'clipping' curve, but I didn't. It seems to go through the FIR first, then there's no clipping because the signal is highly attenuated.

I took a picture of my measurement result but apparently we can't post .jpg here.

fdenk
Posts: 5
Joined: Wed Jan 11, 2023 8:38 am

Re: Filtering and softclip in transducers plugin

Post by fdenk » Mon Jan 30, 2023 10:17 am

Hi Nick,
thank you for running these tests.
Maybe more towards the openMHA developers, I think that this behavior is not what is most practical for many applications, and maybe there should be an option to change the order of filtering and softclipping if desired. Let me explain with an example.
Say you have a hearing aid headset with a transducer with a dip of 20 dB somewhere in its target frequency response (see calibration manual), and you want to equalize that using the FIRs of the transducers plugin. Before the filtering, the signal is approximately free-field related, however, after filtering the signal has no physical meaning. Controlling the maximum output level with the softlcipper will result in unexpected results, in this case it will be triggered at lower levels than desired. For an intuitive parameter setting, the softclipper should in my opinion operate on the free-field related signal prior to output EQ.
Would it be possible to include this option in future releases?
Thanks and best, Florian

tobiasherzke
Posts: 112
Joined: Mon Jun 24, 2019 12:51 pm

Re: Filtering and softclip in transducers plugin

Post by tobiasherzke » Thu Feb 02, 2023 7:57 am

If you want to employ a softclipper before the output side FIR filter of the "transducers" plugin, then please use the separate plugin "softclip" as the last plugin in the chain that you load into plugin "transducers".

The purpose of the softclipper which is integrated into the output side of the "transducers" plugin is to reduce the likelihood of hard clipping occurring in the sound card, and for this purpose, it has to be applied after the FIR filter.

Best strategy for listeners, however, is to avoid the need for clipping in the configuration: When generating your gain table for the dynamic compressor you should take into account band-specific MPOs and not produce output levels that the transducer cannot deliver, given the limitations imposed by the combination of the D/A converter, amplifiers/drivers and transducer. Producing too high output levels in the compressor and relying on a softclipper for MPO enforcement is going to sound bad for the listeners.

fdenk
Posts: 5
Joined: Wed Jan 11, 2023 8:38 am

Re: Filtering and softclip in transducers plugin

Post by fdenk » Fri Feb 03, 2023 1:20 pm

Thank you for pointing me towards the separate softclipper plugin, this is indeed a good idea.

I agree that in general, clipping should be avoided as much as possible. In the specific application, we need a simple switch between maximum output levels in lab settings and public events, but after reading you reply I think it will indeed be best to use the MPO for this application after all.

Post Reply