home/ atoms/ wavetable-algorithm-diagram

The wavetable synthesis signal flow is: index increment → running index → fmod wrap → lookup → amplitude envelope → output

The complete wavetable oscillator algorithm per output sample: (1) compute index increment kinc = fL/fs when frequency changes; (2) add kinc to a persistent index variable; (3) apply fmod to wrap index into [0, L); (4) perform a table lookup at the (possibly fractional) index using interpolation; (5) multiply by the amplitude envelope A[n]. The output y[n] is the amplitude-scaled waveform sample. Resetting the index to 0 when a new note starts ensures phase coherence. Setting kinc to 0 stops the oscillator. This is the reference implementation from which most digital oscillators derive.

Examples

In Python: index = (index + k_inc) % L; output = lerp(table[int(index)], table[(int(index)+1)%L], index%1) * amplitude

Assessment

Trace through 3 samples of the algorithm with L=8, f=1000 Hz, fs=8000 Hz. Write the index, wrapped index, and output value (assume a sine table) for samples n=0, 1, 2.

“For each new output sample, index increment is added to the `index` variable stored in a single-sample buffer”
corpus · wavetable-synthesis-algorithm-explained-wolfsound · chunk 4