-
Notifications
You must be signed in to change notification settings - Fork 45
WaveGenerator
A WaveGenerator can be used to create a single cycle of a given waveform (see WaveForms-enumeration present in global.h for the supported waveforms).
This single cycle can then be used to synthesize repeated periods of the waveform so it can be audible as a pitch. Instead of repeating the function to generate the waveform for the full length of a requested note, the table can be used for a quick "lookup" to get the outline of the waveform, which in turn is interpolated and filtered to keep the re-synthesized signal as high in fidelity as possible.
See WaveTable and TablePool.
void generate( WaveTable* waveTable, int waveformType )
Fills given waveTable 's buffer with a table describing given waveformType (which should be a valid WaveForms-enumeration, see global.h).
The tableLength-property described in the waveTable describes the resolution of the resulting table. The higher this value, the less noise and aliasing occurs, this comes at an expensive of a higher memory usage. A value of around a tenth of the engine's sample rate should provide satisfactory results.