Harmonic Oscillator Module based on Chebyshev polynomials.
More...
#include <harmonic_osc.h>
template<int num_harmonics = 16>
class daisysp::HarmonicOscillator< num_harmonics >
Harmonic Oscillator Module based on Chebyshev polynomials.
- Author
- Ben Sergentanis
- Date
- Dec 2020 Harmonic Oscillator Module based on Chebyshev polynomials
Works well for a small number of harmonics. For the higher order harmonics.
We need to reinitialize the recurrence by computing two high harmonics.
Ported from pichenettes/eurorack/plaits/dsp/oscillator/harmonic_oscillator.h
to an independent module.
Original code written by Emilie Gillet in 2016.
◆ Init()
template<int num_harmonics = 16>
Initialize harmonic oscillator
- Parameters
-
sample_rate | Audio engine samplerate |
◆ Process()
template<int num_harmonics = 16>
Get the next floating point sample
◆ SetAmplitudes()
template<int num_harmonics = 16>
Set the amplitudes of each harmonic of the root.
- Parameters
-
amplitudes | Amplitudes to set. Sum of all amplitudes must be < 1. The array referenced must be at least as large as num_harmonics. |
◆ SetFirstHarmIdx()
template<int num_harmonics = 16>
Offset the set of harmonics. Passing in 3 means "harmonic 0" is the 3rd harm., 1 is the 4th, etc.
- Parameters
-
idx | Default behavior is 1. Values < 0 default to 1. |
◆ SetFreq()
template<int num_harmonics = 16>
Set the main frequency
- Parameters
-
freq | Freq to be set in Hz. |
◆ SetSingleAmp()
template<int num_harmonics = 16>
Sets one amplitude. Does nothing if idx out of range.
- Parameters
-
amp | Amplitude to set |
idx | Which harmonic to set. |
The documentation for this class was generated from the following file: