LMMS/lmms — pull request #578 by diizy (2014-04-07 20:09:25+00:00)
Title: Bandlimited waveform generation

Adds 2 new files: BandLimitedWave.cpp, BandLimitedWave.h

These implement the BandLimitedWave class which contains static functions only for now (one could extend this to be similar to the Oscillator class, but it might be better to just make the existing Oscillator to utilize the waveform generation here)

BandLimitedWave.h contains a mipmap struct which is used to store the pre-generated waveforms. These waveforms are generated at startup - this may add a bit to startup time. IMO the added delay isn't that onerous or even noticeable, but if it becomes an issue we can figure out a way to do the generation compile-time, or even provide the waveforms as pre-generated binary files.

The generation function is called from main.cpp. If this isn't the right place for it, let me know and I can change it.

There's also an initial utilization of these functions in Monstro, which also serves to show how they are meant to be used.

These waveforms provide a quite noticeable reduction in aliasing when compared to the simple wavefunctions. Especially in saw and square you can hear the difference with bare ear.