#include <wavetable.hh>
A wavetable oscillator.
The path argument to the constructor should point to a .wav file that has 64 sections of 1024 samples. Each section should be one cycle of the oscillator. You can use the morph input (in [0,1]) to choose the wave to play. The oscillator will interpolate between waves. For example, inputing w=0.1482 result in the following linear combination of waves floor(64*w) = 9 and ceiling(64*w) = 10:
(1-64*w) * 9 + 64*w*10
Example wavetables of the correct format can be found in the wavetables directory.
[in] | morph | A value in the interval [0,1] |
[in] | amplitude | |
[out] | signal |
Public Member Functions | |
Wavetable (string path) | |
void | update () |
![]() | |
void | init () |
virtual void | update () |
![]() | |
virtual void | init ()=0 |
virtual void | update ()=0 |
int | add_input (string name) |
int | add_output (string name) |
int | get_input_index (string name) const |
string | get_input_name (int index) const |
string | get_output_name (int index) const |
int | get_output_index (string name) const |
void | set_input (string name, double value) |
void | set_input (int index, double value) |
double | get_input (int index) const |
double | get_input (string name) const |
double | get_output (string name) const |
double | get_output (int index) const |
void | set_output (int index, double value) |
void | copy_inputs (const Module &source) |
void | copy_outputs (Module &destination) const |
void | configure (std::vector< std::tuple< string, double > > assignments) |
int | num_inputs () const |
int | num_outputs () const |
void | emit (Event e) |
void | set_ts (double s) |
double | get_ts () |
|
virtual |
This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.
Reimplemented from yase::Oscillator.