Control Rate frequency for Filter Cutoff modulation

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Ok, I'm not going to discuss DSP basics here. Think Chrisboy2000 got an answer.

A modultion signal is nothing differnt to an audio signal.
Just skip the "modulation" and call it signal.

All this talk about haromics, aliasing ect pp. has been solved many years ago already.
Just use existing solutions.
Sample 2x of highest frequency. Use aliasing-filter to solve the problem of harmonics aliasing to lower bands or if you don't want, simply oversample (like on my example, 32x oversampling is still only 1:8 of audio rate so you kill harmoncis up to the 32th without filtering or any special trick).

(and yes [1,1,-1,-1] is no square wave ffs ... because it is a band-limited signal and you cannot have a square wave on a band-limited signal .. but this is f*cking DSP basics and has nothing todo with the topic)

Post

I agree, this stuff has been solved many years ago and is rather basic.

If you have a naively sampled (1,1,-1,-1) 100Hz square wave running at 400Hz (actually not 200Hz) control rate and upsample it using standard upsampling techniques, you'll get a sine. Much worse, if your square wave is not 100Hz but say 95Hz, there'll be jitter manifesting itself as aliasing which won't get removed by the upsampling.

One could "improve" things by using non-standard upsampling techniques, e.g. linear interpolation, but only so far. Some of the points I mentioned earlier can give an idea of which details to look for.

Post

Ok, so the sample value are be wrong, haven't really though about, just wanted to throw in an example.
much worse, if your square wave is not 100Hz but say 95Hz, there'll be a jitter manifesting itself as aliasing which won't get removed by the upsampling.
hm?
Where can read about the alias caused by jitter during upsample?
Never heart about that so far.
One could "improve" things by using non-standard upsampling techniques, e.g. linear interpolation, but only so far. Some of the points I mentioned earlier can give an idea of which details to look for.
For control signal we almost always use linear, simply because of performance / don't-waste-CPU reasons.
You can configure control channels to be "HQ", means it runs a higher rate (more oversampling) and does quadric interpolation. But never had the need of running cubic interpolation or even do a sinc (modulation signal carries modulation signals on my systems, not audio signals, where linerar interpolation would sound shity most likely ... if you want to carry audio signal, use an audio channel not a control channel)
Last edited by PurpleSunray on Tue Aug 22, 2017 11:49 am, edited 1 time in total.

Post

PurpleSunray wrote:Where can read about the alias caused by jitter during upsample?
Never heart about that so far.
I'm not sure where can you read specifically about that example, but it's the sampling basics. If you naively sample a non-bandlimited signal you get aliasing frequencies. These frequencies are "implicitly" contained in your samples and will become "audible" after going through a DAC. A proper upsampling doesn't remove any frequencies, including the aliasing already contained in the signal. With linear interpolation things are getting more complicated to analyse, since from the sampling theory perspective, linear interpolation is just an extremely poor approximation of a proper upsampling process.
PurpleSunray wrote:For control signal we almost always use linear, simply because of performance / don't-waste-CPU reasons.
You can configure control channels to be "HQ", means it runs a higher rate (more oversampling) and does cubic interpolation. But never had the need of running quadric interpolation or even do a sinc (modulation signal carries modulation signals on my systems, not audio signals, where linerar interpolation would sound shity most likely ... if you want to carry audio signal, use an audio channel not a control channel)
It might work relatively well in a number of situations, and in some others it will work worse (particularly pay attention to the phase modulation argument mentioned before). It won't get rid of the aliasing, though, although it might "distribute" it differently. So other things being equal, as a ballpark guess, your control rate needs to be at least several times higher than your highest modulation frequency, and even then it's rather difficult to theoretically estimate the perceived intensity of all unwanted artifacts. You need to make a listening test and also know, what to listen to.

Post

Z1202 wrote:I'm not sure where can you read specifically about that example, but it's the sampling basics. If you naively sample a non-bandlimited signal you get aliasing frequencies. These frequencies are "implicitly" contained in your samples and will become "audible" after going through a DAC. A proper upsampling doesn't remove any frequencies, including the aliasing already contained in the signal.
Upsampling does not remove anything.
You need to solve aliasing at sampling stage already.
The aliasing filter is part of the ADC not of the DAC.
You need to get rid of harmonics when you sample. If you don't, haromics alias to lower band and no way for DAC to know if it is an alias or if that frequency is intended to be there.
On control signal you can solve it by oversampling since sample rate is low anyhow (i.e. you can't just oversample audio to achive same, would be 48kHz x 32 = 1,5Mhz :o so DACs use alias filter instead ). Or, if you don't want oversampling, add low-pass (alias-filter) to remove haromics (but add it at sampling side, not when doing the upsampling - upsampler does not know if it is an alias or a real frequency)
Z1202 wrote: It won't get rid of the aliasing, though, although it might "distribute" it differently. So other things being equal, as a ballpark guess, your control rate needs to be at least several times higher than your highest modulation frequency,
IT IS
We do 32x oversampling, so waaaaaaaaaay above highest modulation frequency (64 times the frequency, 32 times the sample rate according to nyquist)

Post

PurpleSunray wrote: The aliasing filter is part of the ADC not of the DAC.
You need to get rid of harmonics when you sample.
Exactly. However in the case in question the signals do not go through an ADC, but are getting constructed directly in sampled form. That's why (again, other things being equal), they need to be bandlimited in (or actually before) the construction process, not after it.

In practice one can make lots of shortcuts, often dropping the need to bandlimit, or using special interpolation schemes, but it's better if these shortcuts are done consciously, realizing their implications.

Edit: I'm not sure if our usage of the word "oversampling" is identical, that might be the source of the confusion. I understood that you construct the signal at a low control rate and then oversample it. This won't help, since the aliasing is already there. But maybe you simply mean "running at high control rate", in which case it's more acceptable.

Post

Z1202 wrote:
PurpleSunray wrote: The aliasing filter is part of the ADC not of the DAC.
You need to get rid of harmonics when you sample.
Exactly. However in the case in question the signals do not go through an ADC, but are getting constructed directly in sampled form. That's why (again, other things being equal), they need to be bandlimited in (or actually before) the construction process, not after it.
In practice one can make lots of shortcuts, often dropping the need to bandlimit, or using special interpolation schemes, but it's better if these shortcuts are done consciously, realizing their implications.
So you run aliasing filters after your LFO?

We had a similar thread here some time ago where one was asking exactly this question (do I need aliasing filter on my LFO?). The answer was:
yes you need aliasing filters, unless you limit LFO waveforms to cause aliasing, run a wavetable OSC as LFO with proper wavetables w/o aliasing, or you oversample by an insane amount such as 16x 32x ..
But I feel like writing same here over and over agian.

Post

Edit: I'm not sure if our usage of the word "oversampling" is identical, that might be the source of the confusion. I understood that you construct the signal at a low control rate and then oversample it.
No. Oversampling is about the sampling.
Not sample at low rate, than upsample.
Oversampling means sample at a rate that is higher to nyquist.

Post

PurpleSunray wrote:
Z1202 wrote:That's why (again, other things being equal), they need to be bandlimited in (or actually before) the construction process, not after it.
So you run aliasing filters after your LFO?
Strange you are asking that. I think I specifically wrote above that I'm not. Or, for that matter, that an LFO definitely needs to be antialiased.

Post

Z1202 wrote:
PurpleSunray wrote:
Z1202 wrote:That's why (again, other things being equal), they need to be bandlimited in (or actually before) the construction process, not after it.
So you run aliasing filters after your LFO?
Strange you are asking that. I think I specifically wrote above that I'm not. Or, for that matter, that an LFO definitely needs to be antialiased.
Yes, it's strange that I ask because nobody does this for "normal LFO" - but all use oversampling instead to remove aliasing.
Even you do it - without you even knowing about that you do (never asked yourself why your LFO does not alias even you don't run an alias filter? because you oversample ):P

There are cases where an alias filter might be a good solution.
Like the one from Chrisboy2000.
He only runs envelopes, which we controlls, so he can limit it (i.e. don't allow 1ns decay).
The modulation signal created by the envelope must pass a lot of complex processing.
Complex processing means CPU-load. In order to keep the CPU load as low as possible, select the smallest possible sample rate according to the expected input / output of the envelope-generator. Since you will face aliasing issues if you do so, add an aliasing-filter to the envelope-generator.
So you trade a low-pass filter vs higher sample rate (oversampling).
Depends on the complexity of the modulation signal processing if you go with low-pass or oversampling.

Post

PurpleSunray wrote:
Z1202 wrote:
PurpleSunray wrote:
Z1202 wrote:That's why (again, other things being equal), they need to be bandlimited in (or actually before) the construction process, not after it.
So you run aliasing filters after your LFO?
Strange you are asking that. I think I specifically wrote above that I'm not. Or, for that matter, that an LFO definitely needs to be antialiased.
Yes, it's strange that I ask because nobody does this for "normal LFO" - but all use oversampling instead to remove aliasing.
No, it'd be strange if anybody ran this filter after an LFO or an oscillator. Actually I woudln't even know how to do it :)

Anyway, on a practical side what you're saying is reasonable in quite some contexts (except for your usage of the word "oversampling" which still confuses me a lot, oversampling relatively to what?). My points were more to raise awareness of the sources of control rate artifacts, to be able to make better judgements of the tradeoffs, like:

- what should be my control rate?
- what kind of interpolation should I use?
- are there any specific edge cases which run worse than typical ones?

etc.

Post

About your confusion with oversampling, read this:
https://en.wikipedia.org/wiki/Oversampling
what should be my control rate?
Your highest frequency on control signal x2, at least.
If there are only sine waves on it x2 might be enough. If anything else is on that signal, you need to address aliasing by increasing sampling rate (oversample) and/or alias-filter.
what kind of interpolation should I use?
What do you want to do?
For any kind of user driven stuff as well as "normal LFOs" (<100Hz) we use linear.
We have some special constructs (such as a kind of wave-shaper that accepts frequencies on modulation input that are way above what LFOs would produce). For this we use higher sample rate and quadric interpolation (modulation channel on "HQ" mode).
High bandwith modulation signals, like the input to an FM (comming from another audio OSC) is not a modulation signal for us, but an audio signal (as it requires audio signal bandwith ). No point running lower rates, OSC outputs audio rate anyhow and if it would run at lower rate, upsampling with high-fidelity audio-quality (sinc) would probably negate CPU saving of the lower sample rate again, so it's pointless.
are there any specific edge cases which run worse than typical ones?
Follow best pratices as known from audio DSP also for modulation DSP (it is always same math, the only difference is the sample rate).
Think about edge cases when you optimize.
Like as said above, if you control the env-generator, implement it so that it does not output frequencies above your defined limit by design. Will be cheaper than "synthezising" the envelope at [n] x modulation rate (again -> oversample), filter alias, then downsample to modulation rate (thats how you do an alias filter on an LFO or envelope).
Last edited by PurpleSunray on Tue Aug 22, 2017 2:48 pm, edited 1 time in total.

Post

PurpleSunray wrote:"synthezising" the envelope at [n] x modulation rate (again -> oversample), filter alias, then downsample to modulation rate (thats how you do an alias filter on an LFO or envelope).
A rather unusual (by modern standards) way to antialias synthesized waveforms.

Post

Z1202 wrote:
PurpleSunray wrote:"synthezising" the envelope at [n] x modulation rate (again -> oversample), filter alias, then downsample to modulation rate (thats how you do an alias filter on an LFO or envelope).
A rather unusual (by modern standards) way to antialias synthesized waveforms.
So how you do that?
I know about (and described) two ways:
- build your oscilator in way it does not alias (such as using wabetable OSC, or limit envelope speed/forms). Legacy standard for digital oscilators.
- oversample, low-pass filter and convert to target rate. Legacy standard for ADCs that don't run a low-pass filter on analog side of the circuit.

What's the modern standard?
Last edited by PurpleSunray on Tue Aug 22, 2017 5:05 pm, edited 2 times in total.

Post

.. wrong button ..

Post Reply

Return to “DSP and Plugin Development”