Package toxi.math.waves
Class FMHarmonicSquareWave
java.lang.Object
toxi.math.waves.AbstractWave
toxi.math.waves.FMHarmonicSquareWave
Frequency modulated bandwidth-limited square wave using a fourier series of harmonics. Also uses a secondary wave to modulate the frequency of the main wave.
Note: You must NEVER call the update() method on the modulating wave.
-
Field Summary
Modifier and TypeFieldDescriptionint
Maximum harmonics to add (make sure you stay under Nyquist freq), default = 9 -
Constructor Summary
ConstructorDescriptionFMHarmonicSquareWave
(float phase, float freq, float amp, float offset) Convenience constructor to create a non frequency modulated square waveFMHarmonicSquareWave
(float phase, float freq, float amp, float offset, AbstractWave fmod) FMHarmonicSquareWave
(float phase, float freq, AbstractWave fmod) -
Method Summary
Methods inherited from class toxi.math.waves.AbstractWave
cyclePhase, cyclePhase, hertzToRadians, radiansToHertz, setPhase, toString
-
Field Details
-
fmod
-
maxHarmonics
public int maxHarmonicsMaximum harmonics to add (make sure you stay under Nyquist freq), default = 9
-
-
Constructor Details
-
FMHarmonicSquareWave
-
FMHarmonicSquareWave
public FMHarmonicSquareWave(float phase, float freq, float amp, float offset) Convenience constructor to create a non frequency modulated square wave- Parameters:
phase
-freq
- base frequency (in radians)amp
-offset
-
-
FMHarmonicSquareWave
-
-
Method Details
-
pop
public void pop()- Overrides:
pop
in classAbstractWave
-
push
public void push()- Overrides:
push
in classAbstractWave
-
reset
public void reset()Resets this wave and its modulating wave as well.- Overrides:
reset
in classAbstractWave
- See Also:
-
update
public float update()Progresses the wave and updates the result value. You must NEVER call the update() method on the modulating wave since this is handled automatically by this method.- Specified by:
update
in classAbstractWave
- Returns:
- current (newly calculated) wave value
- See Also:
-