Alias Free Oscs, band limiting, and downsampling

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I'm fairly new to the sampling theory/plugin development world, so maybe some of the dsp gurus here can help me out with my little conundrum.

From what I've learned, this is how anti-aliasing works: Please correct me if I'm wrong.

A low pass (band limiting) filter is put on an osc before it is resampled to the desired sample rate so the high frequency components don't cause aliasing.

That's all well and good in theory, however filters can't just go from x dB to x-whatever dB instantly, they must roll off the highs gradually. This means, at 44.1khz, in order to prevent all aliasing, some of the natural audible high frequencies must be lots.

At 48khz or above, this isn't a problem since the frequencies rolled off can't be heard anyway.

But if the project is at 44.1 (as most are, mine anyway), you'll need to downsample at the end anyway, which will require band limiting, and will result in a loss of high frequency content.

So my question is, is it possible to program an osc that will run at 44.1 khz, not alias, and keep all of it's audible natural harmonic content? I see lot's of synths touting "alias free" oscillators (by that I'm assuming they mean with all of the audible content, as opposed to antialiased). Is it even possible to have alias free oscs in that sense in a 44.1 project? If so, how?

Responses much appreciated, thanks.

Post

3*s wrote:A low pass (band limiting) filter is put on an osc before it is resampled to the desired sample rate so the high frequency components don't cause aliasing.
That's a reasonable approach for a sample-playback architecture, yes. Alternately, if you're doing pure synthesis, you can construct wavetables additively and simply never have frequency components high enough to alias.
That's all well and good in theory, however filters can't just go from x dB to x-whatever dB instantly, they must roll off the highs gradually. This means, at 44.1khz, in order to prevent all aliasing, some of the natural audible high frequencies must be lots.

At 48khz or above, this isn't a problem since the frequencies rolled off can't be heard anyway.
Except that the freq range of human hearing varies from person to person, and doesn't snap from audible to inaudible at exactly 20KHz. :) Will the listener notice if you start rolling off early? Will the listener notice if there's a small amount of aliasing, attenuated but not completely eliminated, above a certain freq? If you say you can tolerate -60dB of alias noise at 18KHz and start rolling off high frequencies at the same point, then you need about 120dB/octave cutoff slope (20-pole filter). If you can handle -48dB noise at 16Khz, you only need 60dB/octave (10-pole filter). There's plenty of design range in there to play with. The difference between 44KHz and 48KHz is one of degree, not of kind.
So my question is, is it possible to program an osc that will run at 44.1 khz, not alias, and keep all of it's audible natural harmonic content? I see lot's of synths touting "alias free" oscillators (by that I'm assuming they mean with all of the audible content, as opposed to antialiased). Is it even possible to have alias free oscs in that sense in a 44.1 project? If so, how?
Define "natural harmonic content". Sawtooth, square, and triangle waves are unnatural; it's only their artificial mathematical definition that gives them arbitrarily high harmonics; if you're generating wavetables additively for them, you can guarantee absolutely no aliasing. If you're doing sample playback, you can load up the source sample, spend a fair amount of time filtering it sharply to optimize its harmonic content for each note on the keyboard, and get arbitrarily close to the 22KHz Nyquist limit with arbitrarily little aliasing.
Image
Don't do it my way.

Post

Such simple and large exactly precalculated wavetables require then also a very smart algorithm for playback. Cause oscillators are not that static.

As soon a user tweaks the pitch bend wheel in realtime or slides the pitch up in any other way you'll get the problems with aliasing never the less.

Post

jackle&hyde wrote:As soon a user tweaks the pitch bend wheel in realtime or slides the pitch up in any other way you'll get the problems with aliasing never the less.
Crossfade between the wavetables according to the "real note" being played, which may be fractional. That takes care of pitch bend and vibrato. FM is a little harder. If you have per-octave wavetables, this means the upper octave fades in and out in a way that some people might not like, but with per-note wavetables it's not a problem.
Image
Don't do it my way.

Post

And what's with oscillator hard sync then? Maybe a combination of FM and hard sync and ring modulation alltogether (like on the Virus)?

Post

jackle&hyde wrote:And what's with oscillator hard sync then? Maybe a combination of FM and hard sync and ring modulation alltogether (like on the Virus)?
For hardsync, use a bandlimited step (MinBLEP) to cover the discontinuity. (Personally, I don't much care about hardsync - it's such a pain to do it antialiased that you might as well find a different way to get similar results.)

For FM and RM, you have to work a little harder.

With RM, you know that the highest sideband is the sum of the freqs of the highest partials of each component, so you could maybe pick the wavetables that you'd use if you were playing one octave higher than you actually are.

With FM between two complex waveforms, you're boned. Personally I'd use the same solution as RM, and accept the aliasing - it's not the end of the world. Others might recommend oversampling and filtering.
Image
Don't do it my way.

Post

I linearly interpolate between two similar waveforms, with different harmonic content.
The higher the note, the lower the position of interpolation (go to low harmonic content).
I use keyboard->wave maps for this.
No filters and no oversampling.

But this is possible because they are synthesized wavetables (in "Solo").

Post

Yes, that's an processing power friendly and simple solution. But too simple to produce any shopisticated sound synthesis (in view of oscillator spectra).

Post

jackle&hyde wrote:Yes, that's an processing power friendly and simple solution. But too simple to produce any shopisticated sound synthesis (in view of oscillator spectra).
Meridian doesn't currently do so, but its osc engine is capable of synthesizing wavetables whose spectral envelopes have both fixed-pitch features (like formant peaks) and features dependent on the fundamental of the note played. In fact, it could do completely different spectral envelopes for each octave, and the crossfade would smoothly morph the timbre as you played/pitchbent/vibrato'd across the keyboard.
Image
Don't do it my way.

Post

Yes, it's simple.
But I use fm, am, formants, discrete summation formulas, physical modeling there, all in the same time. It is sophisticated. I just take care of top harmonics by limiting pre-modulation harmonics...

I really like not to deal with oversampling...

Post

Borogove wrote:
For hardsync, use a bandlimited step (MinBLEP) to cover the discontinuity. (Personally, I don't much care about hardsync - it's such a pain to do it antialiased that you might as well find a different way to get similar results.)
Right, there must be an other way too.

Because you actualy have to implement MiniBLEP or BLIT for allot of differnt waveforms (the Virus has for instance 64 different ones) then.

And you have to implement Frequency Modulation, Oscillator Synchronisation, Pulsewidth Modulation and Ring Modulation additionally to those oscillators (like on the Virus for instance).

All can perform at the same time finally. Possibly multitimbre and polyphonic.

It's quite a complex task. Isn't it? There aren't that many VSTIs which perform such a compexity yet.

8)

Post

jackle&hyde wrote:And what's with oscillator hard sync then? Maybe a combination of FM and hard sync and ring modulation alltogether (like on the Virus)?
Hard Sync doesn't need oversampling to keep aliasing inaudible, even when using wavetables. I posted the algorithm I use for hard sync (Zebra, FilterscapeVA) on musicdsp mailing list, roughly a year ago. In the end, clever tuning can do the trick ;-)

In my opinion, oversampling should be your last weapon. I would always try to get stuff sound really good without it, and maybe implement it afterwards. So far, there has not been the need for oversampling here.

Cheers,

;) Urs

P.S.: Has anyone ever tried to use a serial allpass and hilbert transformer, mixed with the input signal as a halfband or even quarterband filter?

Post

Urs wrote:
Hard Sync doesn't need oversampling to keep aliasing inaudible, even when using wavetables. I posted the algorithm I use for hard sync (Zebra, FilterscapeVA) on musicdsp mailing list, roughly a year ago. In the end, clever tuning can do the trick ;-)
Maybe. But did you only hard sync or hardsync in combination with FM and PWM (we spoke about)?

I'd like to see the "clever tricks with tuning" then.
:)

Post

jackle&hyde wrote:
Urs wrote:
Hard Sync doesn't need oversampling to keep aliasing inaudible, even when using wavetables. I posted the algorithm I use for hard sync (Zebra, FilterscapeVA) on musicdsp mailing list, roughly a year ago. In the end, clever tuning can do the trick ;-)
Maybe. But did you only hard sync or hardsync in combination with FM and PWM?

I'd like to see the "clever tricks with tuning" then.
:)
Hehe, FilterscapeVA does Hard Sync, FM, PWM, Wavetable modulation and RM at once. The outcome differs from settings and waveforms used though. Much of that stuff sounds crap anyway, regardless of implementation quality ;) "Reasonable" settings sound good tho.

Not going much into detail, I create the wavetables "on demand" by iFFT, whenever the current one does not reflect the actual circumstances (i.e. tuning changed, impact of FM changed, waveform changed). Then, I just fade between old wavetable and new wavetable.

It's a bit more expensive than mip-mapping, but it allows for pretty drastic modulations.

In any case, I don't do anything special for hard sync. The most important thing here, you should not just set the phase to zero. Set it to where it should be. And then, recalculate like 4-8 samples back and fade with the ones you've already got from before phase wrapping. That sounds pretty good.

Another trick, don't wrap to zero phase. Wrap to 75% phase, so that another wrap happens shortly after the sync incident. This way you get a more spiffy sound, and tuning the synced oscillator lower than the syncing might still sound good.

Cheers,

;) Urs

Post

jackle&hyde wrote:Because you actualy have to implement MiniBLEP or BLIT for allot of differnt waveforms (the Virus has for instance 64 different ones) then.

And you have to implement Frequency Modulation, Oscillator Synchronisation, Pulsewidth Modulation and Ring Modulation additionally to those oscillators (like on the Virus for instance).
Um, I don't believe any of those features are particularly dependent on the waveform in use. I suppose some implementations of them could be...
Image
Don't do it my way.

Post Reply

Return to “DSP and Plugin Development”