|
eDSP
0.0.1
A cross-platform DSP library written in C++.
|
The class sawtooth_oscillator generates a sawtooth signal. More...
#include <sawtooth.hpp>
Public Types | |
| using | value_type = T |
Public Types inherited from edsp::oscillators::oscillator< T > | |
| using | value_type = T |
Public Member Functions | |
| constexpr | sawtooth_oscillator (value_type amplitude, value_type samplerate, value_type frequency, value_type width) noexcept |
| Creates a sawtooth oscillator that generates a waveform with the configuration. More... | |
| constexpr value_type | operator() () |
| Generates one step. More... | |
| constexpr void | set_width (value_type width) noexcept |
| Set the width of the periodic signal. More... | |
| constexpr value_type | width () const noexcept |
| Returns the width of the periodic signal. More... | |
Public Member Functions inherited from edsp::oscillators::oscillator< T > | |
| constexpr | oscillator (value_type amplitude, value_type samplerate, value_type frequency, value_type phase) noexcept |
| Creates an oscillator that generates a waveform with the configuration. More... | |
| constexpr value_type | frequency () const noexcept |
| Returns the fundamental frequency in Hz. More... | |
| constexpr void | set_frequency (value_type frequency) noexcept |
| Sets the fundamental frequency of the periodic signal. More... | |
| constexpr value_type | phase () const noexcept |
| Returns the phase shift in radians. More... | |
| constexpr void | set_phase (value_type phase) noexcept |
| Sets the phase shift of the periodic signal. More... | |
| constexpr value_type | timestamp () const noexcept |
| Returns the current timestamp of the signal in seconds. More... | |
| constexpr void | set_timestamp (value_type timestamp) noexcept |
| Sets the current timestamp of the periodic signal. More... | |
| constexpr value_type | samplerate () const noexcept |
| Returns the sampling frequency in Hz. More... | |
| constexpr void | set_samplerate (value_type samplerate) noexcept |
| Sets the sampling frequency. More... | |
| constexpr value_type | sampling_period () const noexcept |
| Returns the sampling period in secs. More... | |
| constexpr value_type | amplitude () const noexcept |
| Returns the amplitude of the periodic signal. More... | |
| constexpr void | set_amplitude (value_type amplitude) noexcept |
| Set the amplitude of the periodic signal. More... | |
| constexpr void | reset () noexcept |
| Reset the oscillator to the original state. More... | |
The class sawtooth_oscillator generates a sawtooth signal.
The signal increases linearly from -1 to 1 in \( [0, 2 \pi wi] \) interval, and decreases linearly from 1 to -1 in the interval \( 2 \pi w, 2 \pi] \), where \( w \) is the width of the periodic signal.
If \( w \) is 0.5, the function generates a standard triangular wave. The triangle wave shares many geometric similarities with the sawtooth wave, except it has two sloping line segments.
| using edsp::oscillators::sawtooth_oscillator< T >::value_type = T |
|
noexcept |
Creates a sawtooth oscillator that generates a waveform with the configuration.
| amplitude | Amplitude of the waveform. |
| samplerate | The sampling frequency in Hz. |
| frequency | The fundamental frequency of the signal (also known as pitch). |
| width | Width factor, numeric value from [0,1] |
| constexpr sawtooth_oscillator< T >::value_type edsp::oscillators::sawtooth_oscillator< T >::operator() | ( | ) |
Generates one step.
|
noexcept |
Set the width of the periodic signal.
| width | Numeric value from in the interval [0,1] |
|
noexcept |
Returns the width of the periodic signal.
The width is a real number between 0 and 1 which specifies the point between 0 and \( 2 \pi \) where the maximum is.
1.8.13