How to hande a DC Offset at the audio output


I’m building a plugin of a wavefolder with some complex logarithmic, exponential and lambert w functions (which I have obviously fast-approximated). It consists on some folding stages and a tanh at the output of the DSP processing chain. I have two parameters, one is the amount of folding and the other is a dc offset that is added at the input. The problem is that this dc offset at the input generates a (not audible) dc offset at the output when there is no signal at the input. When I have audio signal at the input, I don’t get troubles.
So I’d like to ask if there is a best practice to manage this problem.
I have two ideas in my mind, that probably could sound too brutal:

  • Bypass the entire wavefolder processing if there is no signal at the input (I was thinking about the getRMSlevel method)
  • Apply an high pass filter at the output with a zero at a very low frequency

What do you suggest me? Is there another better solution?

Thank you so much!

Applying a high pass filter is the usual way of getting rid of DC offset IIRC.

1pole HP @ 5hz works well for us

Thank you very much guys!