I encountered a serious clipping problem in a patch today that took some time to debug.
Well, it's not actually a bug but something to be aware of in certain patches with modules that can't cope with large DC offsets added to their audio inputs.
Here's a test rig that shows the effect...
It's caused when a pulse wave is low-pass filtered. As you can see, one can end up with a huge DC offset.
The solution is to apply a high-pass filter with a low as possible cut-off frequency after the low-pass filter.
DC Offset
- huggermugger
- Posts: 346
- Joined: Tue Jun 29, 2021 6:42 pm
Re: DC Offset
Interesting, and good catch! Even dropping the HPF cutoff to 0 Hz makes the difference.
- Attachments
-
- Screen Shot 2022-04-26 at 11.41.08 AM.png (785.19 KiB) Viewed 2307 times
Re: DC Offset
You do have to be careful in this situation, though.
Effectively, once you've fed the output of the LPF into the HPF, the pulse wave is spending its low period just below 0V, but its brief high period will shoot up to nearly 10V. This is fine when the LPF is limiting the slew rate so it never reaches 10V. However, if you should raise the cutoff freq of the LPF, the peak voltage will break through and exceed 5V, leading to other potential clipping situations down the line.
If you attenuate the LPF output to 50% before feeding it to the HPF, you can guarantee to stay within the 'safe' limits of +/- 5V.
On a slight tangent, I don't believe the CA filter does actually get down to 0Hz, despite what the cutoff knob says.
Not to blow my own trumpet, but the Smol Rat goes waaaaaaaaay lower than it!
Effectively, once you've fed the output of the LPF into the HPF, the pulse wave is spending its low period just below 0V, but its brief high period will shoot up to nearly 10V. This is fine when the LPF is limiting the slew rate so it never reaches 10V. However, if you should raise the cutoff freq of the LPF, the peak voltage will break through and exceed 5V, leading to other potential clipping situations down the line.
If you attenuate the LPF output to 50% before feeding it to the HPF, you can guarantee to stay within the 'safe' limits of +/- 5V.
On a slight tangent, I don't believe the CA filter does actually get down to 0Hz, despite what the cutoff knob says.
Not to blow my own trumpet, but the Smol Rat goes waaaaaaaaay lower than it!
______________________
Dome Music Technologies
Dome Music Technologies
- honki-bobo
- Posts: 306
- Joined: Sat Nov 09, 2019 1:18 pm
Re: DC Offset
It's not a bug, it's a feature... seriously!
Mathematically speaking, a LPF is basically performing a weighted moving average of a given number of samples. When you're feeding it a square wave with a pulse width of nearly 0% you're basically left with mostly samples of -5V, thus leaving you with mostly (close to) -5V at the output. If you crank up the pulse width to nearly 100% you will notice the output of the LPF moves towards 5V.
Speaking in terms of frequency, a DC offset is a signal of 0 Hz. This is why you can remove it by passing the signal through a HPF.
If the filter does not introduce resonance/feedback (or amplification, which it shouldn't), the output of the filter should also not exceed the voltage range of the input signal.
Mathematically speaking, a LPF is basically performing a weighted moving average of a given number of samples. When you're feeding it a square wave with a pulse width of nearly 0% you're basically left with mostly samples of -5V, thus leaving you with mostly (close to) -5V at the output. If you crank up the pulse width to nearly 100% you will notice the output of the LPF moves towards 5V.
Speaking in terms of frequency, a DC offset is a signal of 0 Hz. This is why you can remove it by passing the signal through a HPF.
If the filter does not introduce resonance/feedback (or amplification, which it shouldn't), the output of the filter should also not exceed the voltage range of the input signal.
Re: DC Offset
A solution is on the way. I created a module, which can remove DC part of a signal without changing signal itself. That module waits for approvement.
Re: DC Offset
Just a quick note. VM doesn't have a "safe zone" within a patch and will quite happily process trillion volt signals (without arcing). The only place that matters in this regard is the output signal back into the world, and if you exceed 5v there, just turn it down.
Re: DC Offset
Good to know. Many thanks!MRBarton wrote: ↑Wed Apr 27, 2022 6:03 pm Just a quick note. VM doesn't have a "safe zone" within a patch and will quite happily process trillion volt signals (without arcing). The only place that matters in this regard is the output signal back into the world, and if you exceed 5v there, just turn it down.
______________________
Dome Music Technologies
Dome Music Technologies
Re: DC Offset
You are right at a theoretical level but in practice signal levels can be critical in all kinds of situations beyond just the final outputs.MRBarton wrote: ↑Wed Apr 27, 2022 6:03 pm Just a quick note. VM doesn't have a "safe zone" within a patch and will quite happily process trillion volt signals (without arcing). The only place that matters in this regard is the output signal back into the world, and if you exceed 5v there, just turn it down.
Anything that involves envelope following for instance. Or modules that do wave folding, saturation or distortion. Or doing something like FM when there's an unexpected 3V bias to the modulation.
Re: DC Offset
I was checking out the differences in operation of some low-pass filters today. I was quite surprised at how quickly the VM904a started to go into saturation. The output appears to be clamped to +/- 5V.
Input is standard CA Oscillator on sawtooth wave (+/-5V) attenuated to various levels:
Attenuation at 32%: Attenuation at 50%: Attenuation at 75%:
to be continued (due to number of attachments allowed)...
______________________
Dome Music Technologies
Dome Music Technologies
Re: DC Offset
Attenuation at 100%:
Attenuation at 100%, +1V DC offset at input: Attenuation at 100%, +3.9V DC offset at input: As you can see, the output becomes unipolar with a +3.9V DC offset at the input.
I'm not complaining about it, though! Just making an observation about possible knock-on effects from DC offsets before getting to the output stage.
Whilst the saturation is symmetrical around 0V, when you add a DC offset to the input, the output becomes asymmetrical:Attenuation at 100%, +1V DC offset at input: Attenuation at 100%, +3.9V DC offset at input: As you can see, the output becomes unipolar with a +3.9V DC offset at the input.
I'm not complaining about it, though! Just making an observation about possible knock-on effects from DC offsets before getting to the output stage.
______________________
Dome Music Technologies
Dome Music Technologies