# Band limited wavetables

I am a bit confused with the concept of band limited wavetables and the methods such as BLET, BLIP, MinBLEP, polyBLEP etc.

As far as I understand certain waveforms contain infinite harmonics, which alias back into the signal, even if they were generated at a certain frequency below the Nyquist rate. According to this paper Alias-Free Digital Synthesis of Classic Analog Waveforms, these basic waveforms have aliasing "due to having to round off the discontinuity time to the nearest available sampling instant".

What and were is the discontinuity of the waveform if the wavetable contains e.g. a full cycle of a sawtooth wave at a certain frequency? (where looping the table will restart the new cycle from the last point of the old one)

After reading through some code on how MinBLEPs work, Im confused with how all these steps are linked. E.g. the signal is windowed and FFT'd and I assume the cepstrum function is used to look for the discontinuity inside the FFT bins. I dont get what the minimum phase is used for. The signal is then run through the iFFT.

I please need help in understanding how all these techniques are combined and what exactly is done in the practical sense.

After all of this, is the minBLEP a kind of wavelet that is stored in a buffer and then applied to the signal being generated, so that it smooths the discontinuities? At first I thought this was all done inside an oscillator which needs some level of look ahead to constantly detect discontinuities and apply the minBLEP wavelet at the correct time, but now I don't get how this is done inside the wavetable generator function itself (offline), that an oscillator can just scan in real time.

It looks like you are mixing up two techniques: MinBLEP and band-limited wavetables.

## Band-limited wavetables

Let's assume you have a 256 sample long array with a waveform of interest - for example a naive sawtooth, with the first sample in your array at -1 and the last sample at 1.

To replay this data at a variable pitch, two techniques are possible:

First, you can control the rate at which the data is played. For example, to get a 440 Hz pitch, you replay the 256 samples verbatim, at a rate of 112640 Hz. This is possible with custom hardware, and is the technique used in early wavetable synthesizers (PPG Wave, Prophet VS). This requires one clock/DAC per oscillator, and is rather expensive!

Or you use a fixed sample-rate, and you modify the pitch by interpolation through the wavetable. Let's say the sample rate is 48kHz. Playing the data one sample after the other yields a tone with a frequency of $48000 / 256 = 187.5$ Hz. To play a tone at 440Hz, you would need to play the data at $440 / (48000 / 256)=2.35$ its original rate, and that's where you get into trouble. Two ways of understanding why:

• You can consider the discontinuity. You'll reach the end of the table and "wrap around" between the 109th and 110th sample. So the discontinuity should actually be located between these samples.

• Or you can think in terms of frequency content: by playing the data at 2.35 its original rate, any harmonic it contains at a frequency above nyquist / 2.35 will be aliased.

There are two ways of dealing with the problem. A first approach is to use band-limited interpolation, which is a way of replaying the data in such a way that aliased components are filtered. Another solution is to pre-compute several variants of your waveform in which the highest harmonics are progressively filtered. For example, when you have to playback the data at twice its original rate, you use a different sawtooth wavetable in which all harmonics above nyquist/4 are filtered-out. Obviously, you can't have a table ready for every possible playback rate, so a common solution is to pre-compute a dozen of such tables (for example one per octave), and interpolate between them. Korg did that on their DW series, I used it on my DIY AVR-based synths.

There are different ways of building such a band-limited table. You can work by additive synthesis (adding the right number of harmonics), or try to derive the band-limited waveforms by operations on a band-limited impulse (sinc waveform).

## minBlep

This technique is completely unrelated to wavetable synthesis. The idea is to precompute a table containing a band-limited and causal step waveform. This computation is done once and for all, and involves an FFT/IFFT - that's probably where you encountered these operations, which are used only at this offline step. The code you link to in your question only covers this step!

Then, in real-time, you generate the naive waveform, and whenever there is a discontinuity in the waveform, you add, over the next 40 samples or so, samples from the band-limited step table to smooth the edge. Which samples you need to add from the minBlep table are determined by the fractional sample at which the discontinuity occurs. No look-ahead is involved: the point of minBLEP is that the correction is causal, so you don't have to start adding it before the discontinuity occurs.

Note that the computational cost of this method will increase as the frequency goes up, since the discontinuities will be more frequent - you'll have to keep track of an increasing number of overlapping corrections.

I wouldn't recommend minBLEP by the way. PolyBLEP uses a polynomial approximation of the band-limited step function and yields very good results. No lookup data is required and the code is easier to write because the correction only lasts for a handful of samples.

## The two together?

It would be a strange idea to mix the two techniques together, but someone could use minBLEP offline to precompute a band-limited sawtooth for various band-limiting ratios. For example, a 256 sample-long naive sawtooth, then a 256 sample-long sawtooth with no harmonic above 0.25, then a 256 sample-long sawtooth with no harmonic above 0.125... And then one could use wavetable playback to replay them - selecting/crossfading one of these tables depending on the required playback rate. This would be a bit odd, there are simpler ways of building wavetables!

• What an excellent answer - thank you. Do you have a link to your DIY AVR-based synths? – donturner Aug 11 '16 at 15:42