Language Guide / Samples and Wavetables
Wavetable
klang::Wavetable
An oscillator that plays a repeating table.
Fill the table with one cycle, or construct it from an oscillator to sample a cycle into the table. Set the playback frequency in Hz after building the table. The table holds the waveform at a fixed resolution, so its harmonic content matters when playing it back at higher pitches.
Example ยท Capture a sine cycle
Sine sine;
Wavetable table(sine, 2048);
Wavetable-based oscillator.
More...
#include <klang.h>
Definition at line 4844 of file klang.h.
◆ Wavetable() [1/2]
| klang::Wavetable::Wavetable |
( |
int | size = 2048 | ) |
|
|
inline |
◆ Wavetable() [2/2]
template<typename TYPE >
| klang::Wavetable::Wavetable |
( |
TYPE | oscillator, |
|
|
int | size = 2048 ) |
|
inline |
Definition at line 4853 of file klang.h.
4855 }
Wavetable & operator=(TYPE &oscillator)
◆ operator const signal &() [1/2]
|
|
inlineoverridevirtualinherited |
◆ operator const signal &() [2/2]
|
|
inlineoverridevirtualinherited |
◆ operator()()
Definition at line 3050 of file klang.h.
3050 {
3051 set(std::forward<params>(p)...); return *this;
3052 }
◆ operator*()
◆ operator+()
◆ operator-()
◆ operator/()
◆ operator=()
template<typename TYPE >
| Wavetable & klang::Wavetable::operator= |
( |
TYPE & | oscillator | ) |
|
|
inline |
Definition at line 4862 of file klang.h.
4862 {
4863 oscillator.set(
fs /
size);
4864 for (
int s = 0; s <
size; s++)
4866 return *this;
4867 }
◆ operator>>()
◆ operator[]()
| signal & klang::Wavetable::operator[] |
( |
int | index | ) |
|
|
inline |
◆ output()
◆ process()
| void klang::Wavetable::process |
( |
| ) |
|
|
inlineoverridevirtual |
◆ reset()
◆ set() [1/4]
| virtual void klang::Wavetable::set |
( |
param | frequency | ) |
|
|
inlineoverridevirtual |
◆ set() [2/4]
| virtual void klang::Wavetable::set |
( |
param | frequency, |
|
|
param | phase ) |
|
inlineoverridevirtual |
◆ set() [3/4]
| virtual void klang::Wavetable::set |
( |
param | frequency, |
|
|
relative | phase ) |
|
inlineoverridevirtual |
◆ set() [4/4]
| virtual void klang::Wavetable::set |
( |
relative | phase | ) |
|
|
inlineoverridevirtual |
◆ buffer
| buffer klang::Wavetable::buffer |
|
protected |
◆ frequency
◆ increment
◆ offset
◆ out
◆ position
◆ size
| const int klang::Wavetable::size |
|
protected |