Wavetable synthesis is perhaps the oldest technique for creating sounds with computers. It involves the storage of a single period of a periodic waveform in a circular buffer. By varying the “speed” with which a read pointer is advanced through the buffer, one can achieve output waveforms of different frequencies. This technique is distinct from simple PCM sample playback in that it always implies looping over the buffer (rather than a “read once” behavior).
Wavetables typically consist of between 128 – 2048 table values (powers of two are common).
The “pitch” of the sound that is produced with wavetable synthesis is dependent on the table size, frequency content of the table data, and playback rate.
A table pointer (or phase accumulator) is incremented at a variable rate to produce sounds at different frequencies.
For a table length of samples, a sample rate of samples per second, and a phase increment sample per time step, the output signal will have a fundamental frequency of (assuming the wavetable holds only one period of the waveform).
The phase increment necessary to produce an output signal with fundamental frequency is given by , where is the sample period.
For example, if your table length is samples and your sample rate is samples per second, the fundamental frequency will be 46.875 Hz with . If , you will read through the table twice as many times in the same time duration, so the resultant frequency will be 93.75 Hz. More generally, if you want Hz, then the pointer needs to jump by 9.387 samples in the buffer per time step () to produce the desired frequency.