Forums > MaxMSP

Comb Filtering, Feedback, and DC Offset

June 29, 2013 | 6:39 pm

There are a couple very old forums about this, but nothing in a while, and I’m at a loss:

I’m using a high-feedback [comb~] pull pitches out of noisy sounds (like a resonator or string modeling), and then reining the FB back in with some soft clipping (just using [tanh~] for now, but there are more interesting options).

The problem I keep running into is that certain sounds result in something that looks like DC offset when it comes out of the filter; the resulting signal is fully outside of the -1/1 range and then centers back around 0 (using [capture~] confirms this). I’m not sure if this is truly DC offset, but it looks like it. Obviously, this results in the audio dropping out and bizarre things with the [tanh~], etc.

I have tried using a tapin~/tapout~ pair for this project as well, and run into similar problems. I wish I could give a better idea of the sort of input sounds that result in this DC offset, but I’m at a loss as to what causes it — noises and pitches, sometimes loud, sometimes soft.

There’s probably a really simple solution or obvious alternative to [comb~] or taps here…

Thanks in advance for your help.

http://www.lawtonhall.com/

<code>

– Pasted Max Patch, click to expand. –

</code>


June 30, 2013 | 3:25 am

Feedback on the comb~ objet never reaches 1.0, right?

As a point of departure you might try high passing the input and output (with a biaquad~ for example) and see if the issue you are experiencing lessens or even stops….


June 30, 2013 | 6:02 am

also, have you tried dcblock~ in the feedback chain?

And as an alternative, do you get the same issue with teeth~ ?


June 30, 2013 | 8:20 am

gain regulation and DC filtering is a good idea anyway before tanh~, FIR filters, or even dynamics processing.


June 30, 2013 | 8:35 am

gen~ has a dcblock operator, which is essentially a biquad~ with the following coefficients:

<code>

– Pasted Max Patch, click to expand. –

</code>


June 30, 2013 | 8:40 am

You’ll also have problems with positive feedback coefficients because this will exacerbate any DC that’s already in the signal. (check it out on spectroscope~, and you’ll see that 0 Hz is an a boost band) Negative coefficients will not boost 0 Hz.

Also, as an alternative to tanh, try:
x / (1 + 0.28*x^2)

It’s like tanh from [-1,1] but it asymptotically approaches 0 (rather than ±1) as x goes to ±inf and this helps with DC issues.


June 30, 2013 | 11:40 am

Peter, I found your advice about lookup tables here, and I’m trying it with the formula you suggested (y=x/(1+0.28*x^2)).

Can you clarify how you use lookup~ for values outside of the [1,-1] range? (i.e. [4,-4])

Here’s where I’m at, using the [biquad~] coefficients suggested by Emmanuel (thanks!):

<code>

– Pasted Max Patch, click to expand. –

</code>


June 30, 2013 | 5:48 pm

I’d skip the lookup table and just directly use the equation because you want the asymptotic return towards zero.

The lookup table is just to replace the expensive calculation of tanh. (Which really isn’t that bad provider you’re not doing tons of them). The range bit: calculate tanh for x between +/-4. (Outside of that tanh is practically +/-1)
Multiply the input to lookup by 0.25.

I think you’ll have better results with the equation, as it is also a handy natural feedback killer.


Viewing 8 posts - 1 through 8 (of 8 total)