a basic triangle oscillator o1
a flexible (and probably too complicated) overtone oscillator otosc
a bell like oscillator, with non integer harmonics, and LCM phasor o2
—-
a couple extra methods to create sine waves:
// a resonant sin wave - based on the state variable filter
ResonantFilterSine(float *frequency, float *output, long samplesPerBlock)
{
long sample;
float freqAngle;
for(sample = 0; sample<samplesPerBlock; sample++)
{
freqAngle = twoPi * *(frequency + sample)/sampleRate
*(output+sample) = sinZ = sinZ + freqAngle * cosZ;
cosZ = cosZ - freqAngle * sinZ;
}
}
// method six - complex multiply sin
SinComplex(float freq, float *freqBlock, float *output, long samplesPerBlock)
{
long sample;
float freqAngle, angleReal, angleImag;
freqAngle = twoPi * freq;
angleReal = cos(freqAngle);
angleImag = sin(freqAngle);
for(sample = 0; sample<samplesPerBlock; sample++)
{
if(freqBlock)
{
freqAngle = twoPi * *(freqBlock + sample);
angleReal = cos(freqAngle);
angleImag = sin(freqAngle);
}
*(output+sample) = angleReal * sinZ - angleImag * cosZ;
cosZ = angleReal * cosZ + angleImag * sinZ;
sinZ = *(output+sample);
if(sinZ > 1.0f) sinZ = 1.0f;
}
}