Antialiasing the modulation

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

I just started thinking:

There seems to be tons of variations how to approach the issue of minimizing aliasing caused by modulation. What's your go-to approach? (this probably depends on the exact synth architecture and synthesis method you use)

For example when you control the amplitude with an ADSR, do you:

1. Initially generate both audio and modulation signals so that highest frequencies don't reach Nyquist/2. Then when you multiply the signals together they won't cross Nyquist? (i.e. oversampled from the beginning)

2. Generate both audio and modulation in playback samplerate. Then upsample them 2x. Then multiply the signals together.

3. Oversample or upsample the audio signal (bandlimited to Nyquist/2). Ignore the frequency content in the modulation signal and generate it in the over/upsampled audio signal's samplerate. Then be brute and multiply them together ignoring the frequencies that bounce back at you from Nyquist.

4. Be lazy and just generate both audio and modulation signals in playback rate. Then multiply them together and laugh on your way to the bank.

5. Something else? What?

Post

I thought ADSR was supposed to slow enough not to cause pops and clicks so (4) looks OK to me.
~stratum~

Post

I'm thinking of fast transients between Attack and Decay (Popcorn sound for example). I would think the transient would sound cleaner if antialiased? I could be wrong.

Or if the modulation isn't ADSR but something else and much faster.

Post

An image from wiki whose title was 'Double-sided spectra of baseband and AM signals' from https://en.wikipedia.org/wiki/Amplitude_modulation

https://en.wikipedia.org/wiki/File:AM_spectrum.svg

That looks like a curve with well defined borders to me.
~stratum~

Post

A simple trick might be to add a simple lowpass with high cutoff behind the adsr to soften this transititon. This reduces the high frequency content of the modulator creating those aliasing sidebands.

Post

@chi cubed:
That could work.

@stratum:
The image you posted is correct. It doesn't make it obvious what happens if both audio signal and the modulation have high frequency content.

Amplitude modulation is multiplication in time domain and convolution in frequency domain. So the unwanted artefacts start presenting themselves for example in the following situation:
- Nyquist at 22 KHz.
- Audio contains content near Nyquist, let's say Nyquist - 2 KHz = 20 KHz.
- Modulation signal contains content near 10 KHz (sharp transient / discontinuity).

In this case (if my math is correct) the highest audio frequencies are shifted 8 KHz over Nyquist, bouncing them back into sampled frequency spectrum: 8 KHz below Nyquist = 14 KHz. If the modulation signal contains frequencies at 20 KHz, the aliased signal would bounce back from Nyquist all the way down to 4 KHz. This can easily happen during the sharp and fast transient/discontinuity between Attack and Decay.

So bandlimiting the modulation could theoretically have an audible effect on the signal.

Post

Modulation signal contains content near 10 KHz (sharp transient / discontinuity).
An ADSR envelope should not contain that as far as I can see.
If you do the same thing with an analog circuit it would cause an undesirable pop/click sound.
~stratum~

Post

I assume envelope's Attack/Decay discontinuity is exactly the same as triangle/saw wave's discontinuity? If this is the case, then you can do a DFT on a naive single saw/triangle waveform cycle and check how high the harmonics go. If the signal is not bandlimited, they should go all the way up to Nyquist. Their amplitudes are quite low, but there's tons of those partials. When tons of them go down to 4 KHz, they could become audible. I would need to test this to be sure though.

Post

Well, that would be the naive way to do it (using straight lines to connect adsr sections). Another way is to set the target value and the use a one pole lowpass as an envelope follower to set the timing of the sections. I guess this could be bandlimited by using bandlimited steps to set both target value and timing coefficient
Last edited by matt42 on Mon Mar 13, 2017 7:24 pm, edited 3 times in total.

Post

When tons of them go down to 4 KHz, they could become audible. I would need to test this to be sure though.
Maybe, seems like having a look at the actual result would be a good idea.
~stratum~

Post

didn't someone just start talking about this to put the kaibosh on newbies?
you come and go, you come and go. amitabha neither a follower nor a leader be tagore "where roads are made i lose my way" where there is certainty, consideration is absent.

Post

didn't someone just start talking about this to put the kaibosh on newbies?
I guess no, newbies are already paranoid about everything by their nature. Been there, done that:) They wouldn't need any help to be more paranoid.
~stratum~

Post

If you have a volume envelope with a sharp (naive) step in it then it will create a sharp step in the modulated signal, which will have aliased frequencies in it. It will sound like a click.

If the volume envelope instead has a band-limited step then it will still sound like a click, but it will be a different click. There could still be aliased frequencies because of the sum of frequencies in the envelope + frequencies in the signal being greater than Nyquist.

If the volume envelope is band-limited, and modulation performed in an over-sampled way and then low-pass filtered to Nyquist before resampling, then there will still be a click but now it will be a band-limited click.

My view is that if you make an envelope with a sharp step, then you intend it to sound clicky, so it doesn't really matter much what kind of click you get (unless you are trying to exactly emulate some analogue gear). So go for the cheapest option.

However if you are modulating with, say, a square wave that approaches audio frequencies then you are moving away from clicky envelopes and into the range of ring-modulation, where aliased frequencies are likely to be sustained and much more noticeable. If your intention when modulating with a square wave is to create lots of extraneous frequencies then that's fine, do it the naive way - but otherwise I'd say the best option would be to band-limit both the modulator and the carrier, modulate at x2 oversampling, and LPF/downsample the result.

Post

@kryptonaut:

I guess I'll try both of the methods and see how different they'll sound.

Post

Applying frequency domain intuition to a time domain modulator... Something about this seems wrong to me. As was mentioned, the click is a transient--it only happens once. From a psychoacoustic perspective, does that really entitle it to have actual frequency content? Like kryptonaut said, you might change the tone of the click by replacing it with a band limited step, but will anyone notice or care? How do you think the distorted shape due to the Gibbs phenomena will sound?

I don't mean to sound like a negative nancy here. By all means try it out and let us know. It's just not an issue I would have paid attention to unprovoked.

Post Reply

Return to “DSP and Plugin Development”