|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
An oscillator: Tune, and pitch, Wave and Shape as ports over a BlepOsc. More...
An oscillator: Tune, and pitch, Wave and Shape as ports over a BlepOsc.
A component on the signal transport. It owns a BlepOsc<> and makes the one conversion from each port to the core's natural units. Its ports are process() arguments after the frame count, in the order PORTS declares (common/transport.hpp):
Tune is a parameter: the frequency at zero pitch in cycles per frame, set once by the app from Hz and the target's sample rate, so the component holds no sample rate.
Out-of-range port values are clamped; a non-finite value counts as 0. Output is the core's, nominally [-1, 1] with the overshoot of its kernel (polyblep.hpp), LATENCY frames late, with the DC the bend and the pulse carry. Output does not depend on block size: every ramp is a fixed number of frames.
#include <vco.hpp>
Public Types | |
| using | Core = BlepOsc<> |
Public Member Functions | |
| Vco () | |
| No Tune until set; a scalar pitch ramps over RAMP_FRAMES. | |
| void | set_tune (float cycles_per_frame) |
| Parameter: the frequency at zero pitch. | |
| template<class... Ports> | |
| void | process (float *out, uint16_t frames, Ports... ports) |
| One block, the ports in PORTS' order, any trailing ones left off. | |
| void | reset () |
| Phase to zero, every ramp at its target, corrections dropped. | |
| float | frequency () const |
| The core's frequency after the last process(), cycles per frame. | |
| float | pitch () const |
| The pitch the ramp is at, octaves. | |
Static Public Member Functions | |
| static float | pulse_amount (float wave) |
| The pulse's weight for a Wave setting, with the saw's weight 1 minus it. | |
| static float | knee_for (float shape) |
| The saw's knee and the pulse's width for a Shape setting: 0.5 halved SHAPE_OCTAVES times across the knob. | |
Static Public Attributes | |
| static constexpr uint8_t | LATENCY = Core::LATENCY |
| static constexpr float | MIN_KNEE = Core::MIN_BREAKPOINT |
| static constexpr float | WAVE_EVENS_DB_PER_UNIT = 40.0f |
| static constexpr float | SHAPE_OCTAVES = 4.0f |
| static constexpr uint16_t | RAMP_FRAMES = Core::RAMP_FRAMES |
| static constexpr uint16_t | CHUNK_FRAMES = 32 |
| static constexpr transport::Port | PORTS [] |
| The ports, in the order process() takes them. | |
| static constexpr transport::Parameter< Vco > | PARAMETERS [] |
| The parameters, for tools. | |
| using sbl::dsp::Vco::Core = BlepOsc<> |
|
inline |
No Tune until set; a scalar pitch ramps over RAMP_FRAMES.
Definition at line 65 of file vco.hpp.
References RAMP_FRAMES, and sbl::dsp::Ramp::set_length().
Referenced by process().
|
inlinestatic |
The pulse's weight for a Wave setting, with the saw's weight 1 minus it.
The saw's even harmonics scale by (1 - w) * 10^(-2w): 40 dB per unit, and gone at 1.
| wave | Wave, clamped to [0, 1]; non-finite counts as 0 |
Definition at line 76 of file vco.hpp.
References sbl::math::clamp01(), sbl::math::finite_or(), and WAVE_EVENS_DB_PER_UNIT.
Referenced by process().
|
inlinestatic |
The saw's knee and the pulse's width for a Shape setting: 0.5 halved SHAPE_OCTAVES times across the knob.
| shape | Shape, clamped to [0, 1]; non-finite counts as 0 |
Definition at line 88 of file vco.hpp.
References sbl::math::clamp01(), sbl::math::finite_or(), and SHAPE_OCTAVES.
Referenced by process().
|
inline |
Parameter: the frequency at zero pitch.
| cycles_per_frame | Tune in cycles per frame; non-finite or negative counts as 0 |
Definition at line 98 of file vco.hpp.
References sbl::math::finite_or().
|
inline |
One block, the ports in PORTS' order, any trailing ones left off.
Pitch as a block is used as given, one frequency per frame. As a scalar it moves to its value over RAMP_FRAMES; the first scalar jumps. Wave and Shape ramp inside the core. A port left off holds its last value, and ramps in progress continue.
| Ports | pitch as a block or an arithmetic scalar, then wave and shape as scalars |
| [out] | out | Output buffer, frames long |
| frames | Frame count | |
| ports | pitch in octaves over Tune; wave in [0, 1]; shape in [0, 1] |
Definition at line 132 of file vco.hpp.
References sbl::transport::fits_v, knee_for(), pitch(), pulse_amount(), sbl::dsp::BlepOsc< Kernel >::set_blend(), sbl::dsp::BlepOsc< Kernel >::set_pulse_width(), sbl::dsp::BlepOsc< Kernel >::set_saw_knee(), and Vco().
|
inline |
Phase to zero, every ramp at its target, corrections dropped.
Definition at line 158 of file vco.hpp.
References sbl::dsp::Ramp::jump(), sbl::dsp::BlepOsc< Kernel >::reset(), and sbl::dsp::Ramp::target().
|
inline |
The core's frequency after the last process(), cycles per frame.
Definition at line 164 of file vco.hpp.
References sbl::dsp::BlepOsc< Kernel >::frequency().
|
inline |
The pitch the ramp is at, octaves.
Definition at line 167 of file vco.hpp.
References sbl::dsp::Ramp::value().
Referenced by process().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
how far the saw's even harmonics fall across Wave
Definition at line 59 of file vco.hpp.
Referenced by pulse_amount().
|
staticconstexpr |
the knee halves this many times across Shape: 0.5 to 1/32
Definition at line 60 of file vco.hpp.
Referenced by knee_for().
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
The ports, in the order process() takes them.
|
staticconstexpr |
The parameters, for tools.