Antialiasing: when to worry about it?
Suppose I plug a phasor~ (non-antialiased sawtooth) into the sinx~ function to generate a waveform. Because this has no partials above the Nyquist frequency, I don’t need to worry about antialiasing it, right?
But now suppose I modulate the frequency of the phasor~. The result can have partials vastly exceeding the Nyquist frequency. That is, they will alias. Is there anything I can do about that? Would, say, replacing the phasor~ with a saw~ (which is antialiased) help? If not, or if so but not completely, what’s to be done?
I know I can’t just plug the sinx~ into a LPF, because the aliasing will have already happened by then — the frequencies have already been folded back into the audible range.
A single partial will not be aliased if its frequency is between 0 and sr/2. Typically you would make this partial with cycle~. Using phasor~->sinx~ will be far less efficient. On the other hand, cycle~ produces a bit of distortion that can be audible in FM synthesis. So if you’re striving for that really pure sound, efficiency be damned.
If you are modulating the sine wave with another sine, you can compute the output harmonics that will be generated fairly easily. Aliasing harmonics will not be generated in 2-op sinewave FM unless the modulation is pretty deep or the frequencies are high. The book "Fm Theory and Applications: By Musicians for Musicians" by John Chowning & David Bristow can be found on the Web and explains the necessary formulas in detail starting from really zero math knowledge. As the authors discuss, aliasing is not necessarily bad in a musical context, forming a big part of the sound of the DX7 for example.
Replacing the phasor~ with a saw~ will only add more phase modulation and thus more aliasing. An simple solution is to oversample your FM oscillator. Wrap the carrier and modulator in something like "poly~ my_FM_patch 1 up 4". Then, still inside the poly, filter out everything over fs(poly)/8 with a lowpass filter of your choosing. Now in your FM patch you can generate harmonics up to fs(poly)/2 without aliasing. Pick an upsampling ratio to make the trade off between efficiency and antialiased bandwidth.
Thanks, Randy! I had no idea oversampling was so easy. That’s great.
Forums > MaxMSP