DC offset Filter - Where to place in an audio chain?

Hi, I’m working on a saturation plugin for mastering engineers.
I added a simple one pole HP filter at 5Hz to filter out the DC, but then doubt struck me.
Where should i place the DC blocker in my chain?
I would have instinctively said at the beginning but i can’t find authoritative resources on the topic.
Can anybody help me with that?

Where’s the DC coming from that you want to get rid of? What makes you want the DC filter in there in the first place? The answers to those questions inform where it needs to go.

If your DSP is sensitive to DC coming in, put it at the input.

If your DSP might create DC, put it at the output.

It’s not forbidden to do both if necessary. A saturator could be such a case.

You as the designer have to make the calls. What helps is to have a concrete benchmark case where you encounter a DC-related problem, and with which you can test whether it’s solved in the way you want. If you don’t have that, there is no point in adding a DC filter because there’s no way for you to know whether it solves an actually existing problem.

1 Like

Thanks for your answer. I was so caught up in the coding process that I didn’t stop to think about what I actually needed to solve.
I agree that in my case I probably need both
Thanks again!

On the basis that you have no control over the signal coming in and it may have a DC offset, then you’ll want to apply a DC blocker at the beginning.

Otherwise, if your saturator is symmetric then the signal won’t have its 0 DC offset at the same place as your saturator. If your saturator is asymmetric, such as a form of diode saturator, then it’ll be even worse.

And…if your saturator is an asymmetric saturator then you’ll probably want to DC block the signal on the way out.

1 Like

I have both symmetric and asymmetric functions so I guess I’m going have a DC blocker at the start of the chain and an additional one at the end IF the selected saturation type is asymmetric.

Whether you need a blocker at the input depends on what you expect there and what you’re doing with it. Let’s say there’s DC coming in at -60dB, that’s effectively a bias into your saturator of 0.001. That probably won’t materially shift how it sounds. The effect would probably only be noticeable with a pure sine + that DC into a perfectly symmetric curve. With that tiny DC the curve will become slightly asymmetric and will thus add odd harmonics that you don’t have with the symmetric one. But probably not even audibly so.

If you add 40dB gain, that’s a bias of 0.1, so much more asymmetric. But you were mentioning mastering, not guitar amp sim.

Note also that even a perfectly symmetric curve can generate DC when the input waveform is asymmetric. There are a lot of DC-free waveforms that are very asymmetric, e.g. brass or any pulse waveform with a pulse width that isn’t exactly 50%.

But yeah, you can probably just drop in both. Note though mastering engineers are quick to shit their pants about something like that because it can “introduce phase issues”. Which is true, but maybe not a catastrophe.

Hugoderwolf is a human and can make mistakes. Please double-check responses.

1 Like

There are a lot of DC-free waveforms that are very asymmetric, e.g. brass or any pulse waveform with a pulse width that isn’t exactly 50%.

Even when developing synths I generally DC block the oscillator output because severe DC offsets - like as found in pulse waves - is going to seriously affect subsequent filter and saturation stages.

I’m not 100% sure if it’s the de-facto standard way of doing things but it makes sense.

1 Like

I wouldn’t recommend using a DC blocker as a catchall that’s just always there. It’s a last resort to catch whatever DC offset you couldn’t get rid of by other means. For example for a pulse oscillator it’s rather easy to compute and subtract the DC offset. It gets more tricky under modulation etc. and depends on the type of oscillator (BLIT, BLEP…), so a little offset can remain which you can shave off with a highpass. Otherwise you’ll get clicks and pops whenever DC offset changes abruptly. The less a DC blocker has to actually block, the better.

At the moment I have the input DC blocker as an option in case one wants to use it.
Then I have another one at the end of the chain to turn on in case an asymmetric function is selected.

Right, I didn’t think about that, but is it going to produce an audible effect? Maybe just having both as an option is the best approach, so one can decide based on the audio. Or just one button to trigger both.

DC by itself is never an audible effect. It can become an audible effect once it hits a nonlinear system (which could also be a DAC for example). Whether you want to burden the users with the decision whether it should be blocked is a call only you can make. Some users want to be burdened with decisions.

1 Like

It gets more tricky under modulation etc. and depends on the type of oscillator (BLIT, BLEP…), so a little offset can remain which you can shave off with a highpass.

In my case the oscillator is a complex wavetable/arbitrarily generated and morphed oscillator. With lots of potential for modulation.

OP has a slightly different use case I guess as he’s doing an FX/saturator.

Anyhow, the usual way of doing a DC blocker is actually a high-pass filter set to a low frequency right? It should be able to recover fairly quickly without creating clicks/pops if it’s set up correctly.

A DC filter will add phase shift that will alter LF summation, so if you have a mix knob in your plugin you might consider also applying that filter (or an equivalent all-pass) there.

In any case, you can check with plugin doctor if your process is adding significant DC and act knowingly. Also an LF pop when enabling/disabling your process is often a good indication something is going on toward DC.