SynthLab SDK
|
The oscillator objects are fundamentally identical except in their rendering operations.
There are two oscillators that do not require any additional files or support:
There are two oscillators that do require additional files:
In this section, we'll work with the WTOscillator object, and using the other oscillator objects will work the same way; when in stanalone mode, there is really nothing to do but let the object maintain its own database and data-accesses.
The SynthLab::WTOscillator object renders audio samples into its AudioBuffer output array. Under normal synth operation you will want to render and process blocks of audio data rather than individual samples (see the SynthBook for more reasoning and ramifiations of this). We will setup this standalone object to render audio blocks of 64 samples per channel (called 64 "frames") and you can test this with your plugin framework by piping the output data samples to your framework's audio output buffer.
You will need to add the following files for the WTOscillator (it includes 4 corse plus a bonus core)
Follow the same pattern and start with the class documentation. The WTOscillator:
We'll choose the SynthLab::FourierWTCore object (index = 2, see docs for WTOscillator class) and jump to its documentation. There we can find the module strings and mod knob assignments. The ModuleStrings are the two Fourier synthesized waveforms:
Module Strings, zero-indexed for your GUI Control:
We will choose the parabola waveform, which as a zero-indexed string entry is [1]. Next, look at the documentation to find the output data (render) location
From the docs on FourierWTCore:
Note that the WTOscillator documentation also shows you how to create the object in standalone mode, we can use this code verbatim because we will setup a blocksize of 64 for this oscillator.
So, we will do the following:
Now, in response to a MIDI note-on message, we setup a MIDIEvent structure (NOTE: we added the call to the pitch calculaton prior to the note-on function call):
At this point, we can start to render values from the oscillator. This shows how to grab the left and right samples from the oscillator's output array; notic the use of the constants:
From here you can keep rendering until the note-off message arrives. Technically, the note-off handler can access the MIDI note number, but in the case of the wavetable oscillator, this value is not used. In fact, most of the objects have note-off handers that are empty. The EGs are a notable exception.
Now, experiment with changing the OSC parameters (see the WTOscParameter documentation to see what you can change). Also, try experimenting with the mod knobs (see SynthLFO tutorial above)