Wavetable index modulation

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Say I have a wavetable with modulated index. I see 2 approaches to handle this:
a) When wavetable index changes, wait for the end of currently playing wavetable and switch to the next (sequencing)
b) Perform crossfading between previous and next wavetables at constant or frequency dependent rate

b) is always smooth, but sounds wrong when I have e.g. PWM stored in 64 indexes. Additional steps appear during crossfading (it may happen even when I crossfade in every e.g. 16 samples).

a) sounds right, but when wavetables don't start and end at the same sample value (say zero), common bandlimiting schemes: mipmap / ifft may result in aliasing.

What is the most common / correct approach here?
giq

Post

I'd imagine the most common approach is to just interpolate from one to the next over one modulation frame. This amounts to "cross fading" when the interpolation is linear, though I believe some synths let you pick from several interpolation schemes. When switching between wavetables without interpolation, your greatest concern is probably not aliasing, but rather the potential clicks whenever you jump from one table to the next.

That said, simple wavetables don't do great PWM whatever you do with your indexing. One approach that works for PWM specifically is to use a wavetable with a saw and then subtract another copy with a modulated phase-offset, but this is obviously something you have to implement as a separate feature.

Post

I was thinking of implementing a half-cycle crossfade. I would diff the old and new wavetable, seek the two largest differences and do the half-cycle crossfade so that those maxima remain outside of the crossfade window. This should avoid some of the worst "double step" artefacts when crossfading PWM-like stuff.

Anyone tried this or similar?

Post

I'm thinking having a large to very large wavetables (index count) would help in this.
(i.e. the finer the detail, the better approximation of PWM). I could be wrong, never tried it.
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

S0lo wrote: Sun Sep 27, 2020 10:50 am I'm thinking having a large to very large wavetables (index count) would help in this.
(i.e. the finer the detail, the better approximation of PWM). I could be wrong, never tried it.
On second thought. It would still need oversampling. So no, not as simple :dog:
www.solostuff.net
Advice is heavy. So don’t send it like a mountain.

Post

Urs wrote: Sun Sep 27, 2020 10:28 am I was thinking of implementing a half-cycle crossfade. I would diff the old and new wavetable, seek the two largest differences and do the half-cycle crossfade so that those maxima remain outside of the crossfade window. This should avoid some of the worst "double step" artefacts when crossfading PWM-like stuff.

Anyone tried this or similar?
For simple PWM picking a point with minimum diff between 2 wavetables usually works, even with instant switch. (the minimum diff is usually zero). But there are always wavetables with more complex wraps that click.
giq

Post

mystran wrote: Sun Sep 27, 2020 9:58 am I'd imagine the most common approach is to just interpolate from one to the next over one modulation frame. This amounts to "cross fading" when the interpolation is linear, though I believe some synths let you pick from several interpolation schemes. When switching between wavetables without interpolation, your greatest concern is probably not aliasing, but rather the potential clicks whenever you jump from one table to the next.

That said, simple wavetables don't do great PWM whatever you do with your indexing. One approach that works for PWM specifically is to use a wavetable with a saw and then subtract another copy with a modulated phase-offset, but this is obviously something you have to implement as a separate feature.
I assumed that wavetables with different values at first / last samples are "designed for clicks". My problem was rather how to properly bandlimit / smooth this transition using common methods.
giq

Post

Hmmm... Assuming I bandlimit WTs using IFFT in realtime, I can perform FFT / IFFT bandlimiting on half cycle shifted frames, that consist of half of current and half of next frame. This way transition points are always in the middle of each processed frame.
giq

Post

itoa wrote: Sun Sep 27, 2020 2:22 pm
mystran wrote: Sun Sep 27, 2020 9:58 am I'd imagine the most common approach is to just interpolate from one to the next over one modulation frame. This amounts to "cross fading" when the interpolation is linear, though I believe some synths let you pick from several interpolation schemes. When switching between wavetables without interpolation, your greatest concern is probably not aliasing, but rather the potential clicks whenever you jump from one table to the next.

That said, simple wavetables don't do great PWM whatever you do with your indexing. One approach that works for PWM specifically is to use a wavetable with a saw and then subtract another copy with a modulated phase-offset, but this is obviously something you have to implement as a separate feature.
I assumed that wavetables with different values at first / last samples are "designed for clicks". My problem was rather how to properly bandlimit / smooth this transition using common methods.
Different values will result in 6dB/octave click. Different first derivatives will result in 12dB/octave click. Difference in 2nd derivative will result in 18dB/octave click and so on.

Post Reply

Return to “DSP and Plugin Development”