1 #ifndef __AgnesiOscillator_h
2 #define __AgnesiOscillator_h
22 : sr(sr), a(a), N(N) {}
23 static float agnesi(
float x,
float a){
24 return (8*a*a*a) / (x*x + 4*a*a);
46 gain = 2/(
agnesi(0, a) - offset);
54 return clamp(gain*(y-offset), -1.0f, 1.0f);
58 float y =
agnesi(x, a*(1+fm));
62 return clamp(gain*(y-offset), -1.0f, 1.0f);
Oscillator that produces an Agnesi curve (Witch of Agnesi) With a=0.5, the output is between near 0 (...
void setPhase(float phase)
Set current oscillator phase in radians.
float getPhase()
Get current oscillator phase in radians.
AgnesiOscillator(float sr, float a, float N)
static AgnesiOscillator * create(float sr, float a=0.5, float N=5)
float generate()
Produce the next consecutive sample.
static float agnesi(float x, float a)
float getFrequency()
Get oscillator frequency in Hertz.
float generate(float fm)
Produce a sample with frequency modulation.
void normalise()
Normalise offset and gain so that signal is between -1 and 1.
static void destroy(AgnesiOscillator *obj)
void setFrequency(float freq)
Set oscillator frequency in Hertz.
void reset()
Reset oscillator (typically resets phase)
An Oscillator is a SignalGenerator that operates at a given frequency and that can be frequency modul...
virtual float generate()
Produce the next consecutive sample.