DSP

Contents

DSP#

Buffers and samples#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP#

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class buffer#

Single-channel float audio buffer.

The fundamental container for sample-level audio data in libYSE. Sub-classes drawableBuffer, fileBuffer, and wavetable layer drawing, file I/O, and wavetable generation on top of this base.

Note

Only the getLength* accessors are thread-safe; all mutating operations and sample-level reads assume the caller has serialised access.

Warning

Do not construct instances as audio-thread locals. Construction allocates from the heap, which is far too slow for a real-time callback. Allocate buffers at file scope or during setup and reuse them.

Subclassed by YSE::DSP::drawableBuffer, YSE::DSP::ramp

Public Functions

buffer(UInt length = STANDARD_BUFFERSIZE, UInt overflow = 0)#

Construct a buffer.

Parameters:
  • length – Number of samples in the buffer.

  • overflow – Extra samples appended past the end, used by sources that need a wrap-around copy of the first sample at the tail (wavetables). Leave at 0 for plain buffers.

buffer(const buffer &cp)#

Copy-construct from another buffer.

inline UInt getLength() const#

Length in samples (frames).

inline UInt getLengthMS() const#

Length in milliseconds at the engine sample rate.

inline Flt getLengthSec() const#

Length in seconds at the engine sample rate.

bool isSilent() const#

Whether every sample in the buffer is zero.

float maxValue() const#

Peak absolute sample value.

inline Flt *getPtr()#

Direct write access to the underlying storage.

Warning

Bypasses every internal invariant maintained by the buffer. Prefer the operator overloads, copyFrom, or the drawableBuffer interface where possible.

buffer &operator+=(Flt f)#

Add f to every sample.

buffer &operator-=(Flt f)#

Subtract f from every sample.

buffer &operator*=(Flt f)#

Multiply every sample by f.

buffer &operator/=(Flt f)#

Divide every sample by f.

buffer &operator+=(const buffer &s)#

Sample-wise add s into this buffer.

buffer &operator-=(const buffer &s)#

Sample-wise subtract s from this buffer.

buffer &operator*=(const buffer &s)#

Sample-wise multiply this buffer by s.

buffer &operator/=(const buffer &s)#

Sample-wise divide this buffer by s.

buffer &operator=(const buffer &s)#

Copy-assign from another buffer.

buffer &operator=(Flt f)#

Fill every sample with f.

buffer &copyFrom(const buffer &s, UInt SourcePos, UInt DestPos, UInt length)#

Copy a region from s into this buffer.

Parameters:
  • s – Source buffer.

  • SourcePos – First sample read from s.

  • DestPos – First sample written in this buffer.

  • length – Number of samples to copy.

buffer &swap(buffer &s)#

Swap contents with another buffer in O(1).

Flt getBack()#

Last sample of the buffer.

buffer &resize(UInt length, Flt value = 0.f)#

Resize the buffer.

Parameters:
  • length – Target length in samples.

  • value – Value used to initialise newly added samples when length exceeds the current size.

inline Flt getSampleRateAdjustment()#

Sample-rate adjustment factor used by the engine to play this buffer at the correct speed when its native rate differs from the engine rate.

inline void setSampleRateAdjustment(Flt s)#

Set the sample-rate adjustment factor.

Normally only the engine calls this.

inline void copyOverflow()#

Refresh the overflow tail (a copy of the first overflow samples).

Most mutating operations already maintain this; calling it manually is rarely necessary.

Public Members

Flt *cursor#

Position cursor — application-owned read/write head pointer.

The buffer never mutates this on its own; it’s a parking slot for user code that needs to remember a position across calls.

Protected Attributes

std::vector<Flt> storage#
Flt sampleRateAdjustment#
UInt overflow#
namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class drawableBuffer : public YSE::DSP::buffer#

Buffer that can be shaped procedurally with envelopes and lines.

Extends buffer with drawing primitives — useful for shaping control signals, building wavetables, or constructing test signals offline. The drawing primitives target buffers used as inputs to other DSP, not buffers fed straight to the audio device, although the engine does not prevent the latter.

Subclassed by YSE::DSP::fileBuffer

Public Functions

inline drawableBuffer(UInt length = STANDARD_BUFFERSIZE, UInt overflow = 0)#

Construct a drawable buffer.

See buffer::buffer.

drawableBuffer &applyEnvelope(const envelope &env, Flt length = 0)#

Multiply the buffer by an envelope shape.

Parameters:
  • env – Envelope to apply.

  • length – Desired envelope length in seconds. If > 0 the envelope is stretched or compressed to this length; if 0 the envelope’s internal length is used as-is.

drawableBuffer &drawLine(UInt start, UInt stop, Flt startValue, Flt stopValue)#

Draw a linear ramp between two positions.

Writes a straight line from (start, startValue) to (stop, stopValue) into the buffer.

Parameters:
  • start – First sample index (in [0, getLength()]).

  • stop – Last sample index (in [0, getLength()]).

  • startValue – Value at start, in [-1.0, 1.0].

  • stopValue – Value at stop, in [-1.0, 1.0].

drawableBuffer &drawLine(UInt start, UInt stop, Flt value)#

Fill a region with a constant value.

Parameters:
  • start – First sample index.

  • stop – Last sample index.

  • value – Value to write, in [-1.0, 1.0].

inline drawableBuffer &operator+=(Flt f)#

Add f to every sample (returns drawableBuffer&).

inline drawableBuffer &operator-=(Flt f)#

Subtract f from every sample.

inline drawableBuffer &operator*=(Flt f)#

Multiply every sample by f.

inline drawableBuffer &operator/=(Flt f)#

Divide every sample by f.

inline drawableBuffer &operator+=(const buffer &s)#

Sample-wise add.

inline drawableBuffer &operator-=(const buffer &s)#

Sample-wise subtract.

inline drawableBuffer &operator*=(const buffer &s)#

Sample-wise multiply.

inline drawableBuffer &operator/=(const buffer &s)#

Sample-wise divide.

inline drawableBuffer &operator=(const buffer &s)#

Copy-assign from a buffer.

inline drawableBuffer &operator=(Flt f)#

Fill every sample with f.

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class fileBuffer : public YSE::DSP::drawableBuffer#

Drawable buffer with built-in load and save.

Adds file-system convenience on top of drawableBuffer: load a channel from disk, or save the contents to WAV.

Subclassed by YSE::DSP::wavetable

Public Functions

inline fileBuffer(UInt length = STANDARD_BUFFERSIZE, UInt overflow = 0)#

Construct a file buffer.

See buffer::buffer.

bool load(const char *fileName, UInt channel = 0)#

Load one channel from an audio file.

Parameters:
  • fileName – Path to the audio file.

  • channel – Channel index. For mono files this must be 0.

Returns:

true on success, false if the file cannot be opened or the requested channel does not exist.

bool save(const char *fileName)#

Save the contents to a mono WAV file.

Note

WAV is currently the only supported output format.

inline fileBuffer &operator=(const buffer &s)#

Copy-assign from a buffer.

inline fileBuffer &operator=(Flt value)#

Fill every sample with value.

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class wavetable : public YSE::DSP::fileBuffer#

Pre-computed single-cycle waveform table.

wavetable is a fileBuffer with a one-sample overflow tail used for wrap-around interpolation, plus generators for the classic band-limited waveforms. Combine with the oscillator family in YSE::DSP for fast playback of complex timbres without per-sample trigonometry.

Public Functions

inline wavetable(UInt length = STANDARD_BUFFERSIZE)#

Construct an empty wavetable of length samples.

void createSaw(Int harmonics, Int length)#

Fill the table with a band-limited sawtooth wave.

Parameters:
  • harmonics – Number of partials to sum. Higher values give a brighter timbre but risk aliasing when played at high pitches.

  • length – Resolution of the table in samples.

void createSquare(Int harmonics, Int length)#

Fill the table with a band-limited square wave.

See createSaw.

void createTriangle(Int harmonics, Int length)#

Fill the table with a band-limited triangle wave.

See createSaw.

void createFourierTable(const std::vector<Flt> &harmonics, Int length, Flt phase)#

Fill the table with a Fourier sum.

Parameters:
  • harmonics – Amplitude per harmonic. harmonics[0] is the fundamental, harmonics[1] is the second harmonic, and so on.

  • length – Resolution of the table in samples.

  • phase – Initial phase offset in radians.

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

Functions

bool LoadFromFile(const char *fileName, buffer &buffer, UInt channel = 0)#

Load a single channel from an audio file into a buffer.

Parameters:
  • fileName – Path to the audio file.

  • buffer – Destination buffer. Resized to fit.

  • channel – Channel index to load. For mono files this must be 0.

Returns:

true on success, false if the file cannot be opened or the requested channel does not exist. < This macro is added to all public class declarations.

bool LoadFromFile(const char *fileName, std::vector<YSE::DSP::buffer> &buffer)#

Load every channel of an audio file into a multichannel buffer.

Returns:

true on success, false on read error. < This macro is added to all public class declarations.

bool SaveToFile(const char *fileName, buffer &buffer)#

Save a single-channel buffer to a mono WAV file.

Note

WAV is currently the only supported output format.

Returns:

true on success, false on write error. < This macro is added to all public class declarations.

bool SaveToFile(const char *fileName, std::vector<YSE::DSP::buffer> &buffer)#

Save a multichannel buffer to a WAV file.

< This macro is added to all public class declarations.

void Normalize(buffer &buffer)#

Scale buffer so its peak absolute sample value equals 1.0.

< This macro is added to all public class declarations.

Math#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

Functions

Flt MidiToFreq(Flt note)#

Convert a MIDI note number (0-127) to a frequency in Hz.

Scalar form. < This macro is added to all public class declarations.

Flt FreqToMidi(Flt freq)#

Convert a frequency in Hz to a MIDI note number.

Scalar form. < This macro is added to all public class declarations.

class abs#

Per-sample absolute value.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class clip#

Hard-clipper.

Limits sample values to [low, high]. Use to tame stray peaks or as a deliberate distortion stage.

Public Functions

clip &set(Flt low, Flt high)#

Set both bounds in one call.

clip &setLow(Flt low)#

Set the lower clipping threshold.

clip &setHigh(Flt high)#

Set the upper clipping threshold.

inline clip()#
YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

aFlt low#
aFlt high#
YSE::DSP::buffer buffer#
class dbToPow#

Per-sample dB → linear (power) conversion.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class dbToRms#

Per-sample dB → linear (RMS amplitude) conversion.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class exp#

Per-sample exponential (e ** in[i]).

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class freqToMidi#

Per-sample Hz → MIDI note conversion.

Buffer-rate counterpart of FreqToMidi.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class inverter#

Per-sample inversion.

In zeroToOne mode the output is 1 - in[i] — useful for inverting a normalised control signal. Otherwise the output is the signed negation -in[i].

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in, bool zeroToOne = false)#

Process in in place.

zeroToOne selects the inversion mode.

Private Members

YSE::DSP::buffer buffer#
class log#

Per-sample logarithm with arbitrary base (log_{in2}(in1)).

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in1, YSE::DSP::buffer &in2)#

Compute log_{in2}(in1) in place.

Private Members

YSE::DSP::buffer buffer#
class midiToFreq#

Per-sample MIDI note → Hz conversion.

Buffer-rate counterpart of MidiToFreq.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class pow#

Per-sample power: in1[i] ** in2[i].

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in1, YSE::DSP::buffer &in2)#

Compute in1[i] ** in2[i] in place.

Private Members

YSE::DSP::buffer buffer#
class powToDb#

Per-sample linear (power) → dB conversion.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class rmsToDb#

Per-sample linear (RMS amplitude) → dB conversion.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#
class rSqrt#

Fast reciprocal square root (~8 mantissa bits of precision).

Significantly cheaper than the standard library version. Use in DSP paths where speed matters more than the last few bits of accuracy.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

rSqrt()#

Private Members

YSE::DSP::buffer buffer#
class sqrt#

Fast square root (~8 mantissa bits of precision).

Same trade-off as rSqrt — cheaper than the standard library, less precise. Use in DSP paths where speed matters.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

sqrt()#

Private Members

YSE::DSP::buffer buffer#
class wrap#

Fractional part — x - floor(x) per sample.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Private Members

YSE::DSP::buffer buffer#

Generators#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class cosine#

Cosine wave oscillator.

Use as a building block for FM synthesis, modulators, or filter sweeps.

Public Functions

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Generate one block driven by per-sample frequency in in.

cosine()#

Private Members

YSE::DSP::buffer buffer#
class noise#

White-noise generator.

Useful as a percussion source, for granular textures, or as a test signal for filters.

Public Functions

YSE::DSP::buffer &operator()(UInt length = STANDARD_BUFFERSIZE)#

Generate a fresh noise block of length samples.

noise()#

Private Members

YSE::DSP::buffer buffer#
Int value#
class oscillator#

Wavetable-driven oscillator.

The general-purpose oscillator — supply a wavetable via initialize and the oscillator plays it back at any frequency. Combine with wavetable::createSaw / createSquare / createTriangle for band-limited classic shapes, or with createFourierTable for custom timbres.

Public Functions

oscillator()#
YSE::DSP::buffer &operator()(Flt frequency, UInt length = STANDARD_BUFFERSIZE)#

Generate a fresh block at frequency Hz.

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Generate one block driven by per-sample frequency in in.

void initialize(wavetable &source)#

Attach a wavetable as the oscillator’s waveform source.

void reset()#

Reset the phase to zero.

Private Functions

void calc(Bool useFrequency)#

Private Members

YSE::DSP::buffer buffer#
Dbl phase#
Flt conv#
Flt frequency#
wavetable *table#
Flt *inPtr#
class saw#

Naive (non band-limited) sawtooth oscillator.

Cheap; aliases at high pitches. Use the wavetable-driven oscillator with a band-limited wavetable::createSaw table for alias-free output.

Public Functions

YSE::DSP::buffer &operator()(Flt frequency, UInt length = STANDARD_BUFFERSIZE)#

Generate a fresh block at frequency Hz.

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Generate one block driven by per-sample frequency in in.

saw()#

Private Functions

void calc(Bool useFrequency)#

Private Members

Dbl phase#
Flt conv#
Flt frequency#
YSE::DSP::buffer buffer#
Flt *inPtr#
class sine#

Sine wave oscillator.

The fundamental building block for additive synthesis, vibrato, and test tones.

Public Functions

YSE::DSP::buffer &operator()(Flt frequency, UInt length = STANDARD_BUFFERSIZE)#

Generate a fresh block at frequency Hz.

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Generate one block driven by per-sample frequency in in.

sine()#
void reset()#

Reset the phase to zero.

Private Functions

void calc(Bool useFrequency)#

Private Members

YSE::DSP::buffer buffer#
Dbl phase#
Flt conv#
Flt frequency#
Flt *inPtr#
class vcf#

Voltage-controlled (variable-cutoff) filter.

A resonant filter whose centre frequency tracks a control buffer. Use it for filter sweeps driven by an LFO, an envelope, or any other DSP buffer.

Public Functions

vcf &sharpness(Flt q)#

Set the resonance (Q factor).

Higher values give a sharper peak.

vcf &operator()(YSE::DSP::buffer &in, YSE::DSP::buffer &center)#

Filter in with cutoff tracked from center.

YSE::DSP::buffer &real()#

Most recent real-part output buffer.

YSE::DSP::buffer &imag()#

Most recent imaginary-part output buffer.

vcf()#

Private Members

Flt re#
Flt im#
Flt q#
Flt isr#
YSE::DSP::buffer realBuffer#
YSE::DSP::buffer imagBuffer#
namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

Enums

enum LFO_TYPE#

Available LFO shapes for lfo and for dspObject::lfoType.

Values:

enumerator LFO_NONE#

No modulation.

enumerator LFO_SAW#

Sawtooth, rising 0 → 1.

enumerator LFO_SAW_REVERSED#

Reverse sawtooth, falling 1 → 0.

enumerator LFO_TRIANGLE#

Symmetric triangle.

enumerator LFO_SINE#

Sine, mapped to [0, 1].

enumerator LFO_SQUARE#

Square wave alternating between 0 and 1.

enumerator LFO_RANDOM#

Stepped random (sample-and-hold) between 0 and 1.

class lfo#

Low-frequency modulator.

Generates a control-rate signal in [0, 1] that can be used to modulate filter cutoff, oscillator pitch, panning, or any other DSP parameter that expects a buffer.

Public Functions

lfo()#
buffer &operator()(LFO_TYPE type, Flt frequency, UInt size = STANDARD_BUFFERSIZE)#

Produce the next LFO block.

Parameters:
  • type – Waveform shape (see LFO_TYPE).

  • frequency – Modulation rate in Hz.

  • size – Block size in samples.

Returns:

Buffer of values in [0.0, 1.0].

Private Members

drawableBuffer result#
Flt cursor#
LFO_TYPE previousType#
UInt lineLength#
Flt currentLineValue#
Flt previousLineValue#

Envelopes and ramps#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class envelope#

Time-value envelope (breakpoint shape).

Extracts an amplitude envelope from a source buffer or loads one from a saved breakpoint file. The resulting envelope can be applied to other buffers via drawableBuffer::applyEnvelope or saved back to disk.

Public Functions

bool create(YSE::DSP::buffer &source, Int windowSize = 15)#

Extract an envelope from an audio buffer.

Parameters:
  • source – Audio data to analyse.

  • windowSize – Analysis window in milliseconds. Larger windows produce a smoother envelope at the cost of responsiveness.

Returns:

true on success.

bool create(const char *fileName)#

Load a previously saved breakpoint file.

void normalize()#

Scale every value so the peak equals 1.0.

bool saveToFile(const char *fileName) const#

Save the breakpoint set to a file.

Returns:

true on success, false on write error.

UInt elms() const#

Number of breakpoints.

Flt getLengthSec() const#

Total envelope length in seconds.

const breakPoint &operator[](UInt pos) const#

Access a breakpoint by index.

Private Members

std::vector<breakPoint> breakPoints#
struct breakPoint#

One vertex of the envelope: a value at a given time in seconds.

Public Functions

inline breakPoint(Flt time, Flt value)#

Public Members

Flt time#
Flt value#
namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class ADSRenvelope#

Playable ADSR-style envelope with optional sustain loop.

Built from a sequence of timed breakpoints; the envelope can be driven through attack / sustain / release phases at runtime. Use to shape note amplitudes in synthesisers or to gate effects.

Public Types

enum STATE#

Playback phases driven by operator().

Values:

enumerator ATTACK#

Advance through the envelope from the start.

enumerator RESUME#

Loop within the sustain region (between loopStart and loopEnd).

enumerator RELEASE#

Advance from the current position to the end.

Public Functions

void addPoint(const breakPoint &point)#

Append a breakpoint.

Warning

Breakpoints must be added in ascending time order — the class does not sort them.

void generate()#

Compile the breakpoints into the runtime envelope.

Call once after all addPoint calls and before invoking operator().

YSE::DSP::buffer &operator()(STATE state, UInt length = STANDARD_BUFFERSIZE)#

Produce the next envelope block for the given phase.

void saveToFile(const char *fileName)#

Save the breakpoints to a file.

inline Bool isAtEnd()#

Whether the release phase has finished playing.

Private Members

std::vector<breakPoint> breakPoints#
buffer envelope#
buffer result#
Flt *phase#
Flt *loopStart#
Flt *loopEnd#
Flt *envelopeEnd#
Bool looping#
Bool endReached#
struct breakPoint#

Envelope vertex.

Param time:

Time in seconds.

Param value:

Value at this time.

Param coef:

Curvature toward this point (0 = linear).

Param loopStart:

Marks the beginning of the sustain loop region.

Param loopEnd:

Marks the end of the sustain loop region.

Public Functions

inline breakPoint(Flt time, Flt value, Flt coef, Bool loopStart = false, Bool loopEnd = false)#

Public Members

Flt time#
Flt value#
Flt coef#
Bool loopStart#
Bool loopEnd#
namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

Functions

void FastFadeIn(YSE::DSP::buffer &s, UInt length)#

Cheap in-place fade-in over the first length samples of s.

Note

length must not exceed s.getLength(). < This macro is added to all public class declarations.

void FastFadeOut(YSE::DSP::buffer &s, UInt length)#

Cheap in-place fade-out over the first length samples of s.

Note

length must not exceed s.getLength(). < This macro is added to all public class declarations.

void ChangeGain(YSE::DSP::buffer &s, Flt currentGain, Flt newGain, UInt length)#

Linearly slew the gain of s from currentGain to newGain.

Applied to the first length samples. Used internally to avoid zipper noise on volume changes. < This macro is added to all public class declarations.

class lint#

Scalar linear interpolator.

Like ramp but block-rate only: advances by one step per update() call rather than producing a sample-accurate buffer. Cheaper when you don’t need per-sample smoothing.

Public Functions

lint &set(Flt target, Int time)#

Start a new ramp toward target over time milliseconds.

lint &setIfNew(Flt target, Int time)#

Like set, but only re-targets if target differs.

lint &stop()#

Freeze the value at the current position.

lint &update()#

Advance one block.

Call once per DSP tick.

Flt target()#

Current target value.

Flt operator()()#

Current value.

lint()#

Private Members

aFlt targetValue#
aFlt currentValue#
aFlt step#
aBool up#
aBool calculate#
Flt stepSecond#
class ramp : public YSE::DSP::buffer#

Sample-accurate ramp generator.

Smoothly slews toward a target value over a time. Use as a smoothing layer in front of parameters that would otherwise click (volume, pan, filter cutoff). Inherits from buffer because each operator() fills its own audio block.

Public Functions

ramp &set(Flt target, Int time = 0)#

Start a new ramp toward target over time milliseconds.

ramp &setIfNew(Flt target, Int time = 0)#

Like set, but only re-targets if target differs from the current target.

ramp &stop()#

Stop ramping; current value becomes the new target.

ramp &update()#

Advance one block.

Call once per DSP tick.

YSE::DSP::buffer &operator()()#

Most recent ramp block.

YSE::DSP::buffer &getSample()#

Same as operator().

Flt getValue()#

Current scalar ramp value (block-rate).

ramp()#
ramp(ramp&)#

Private Members

aFlt target#
aFlt time#
aFlt current#
aInt ticksLeft#
aBool reTarget#
Flt _1overN#
Flt _dspTickToMSEC#
Flt inc#
Flt bigInc#
Int nTicks#
Int l#
Flt *ptr#
Flt f#

Filters#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class bandPass : public YSE::DSP::filterBase#

Resonant band-pass filter.

Passes a band centred on the chosen frequency. Higher q produces a narrower, more resonant band.

Public Functions

bandPass &set(Flt freq, Flt q)#

Set both centre frequency (Hz) and resonance simultaneously.

bandPass &setFrequency(Flt freq)#

Set the centre frequency in Hz.

bandPass &setQ(Flt q)#

Set the resonance (Q factor).

virtual YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

bandPass()#

Protected Attributes

aFlt freq#
aFlt gain#
Flt q#
Flt last#
Flt previous#
aFlt coef1#
aFlt coef2#
aFlt ff1#
aFlt ff2#
aFlt ff3#
aFlt fb1#
aFlt fb2#
buffer samples#

Private Functions

void calcCoef()#

Private Static Functions

static float qCos(Flt omega)#
class biQuad : public YSE::DSP::filterBase#

Configurable biquad filter — the workhorse of DSP filtering.

Pick one of the BQ_TYPE modes (low-pass, high-pass, band-pass, notch, peak, low-shelf, high-shelf) and tune frequency, Q, and peak gain. See earlevel.com/main/2010/12/20/biquad-calculator/ for an interactive parameter visualiser.

Public Functions

biQuad &set(BQ_TYPE type, Flt frequency, Flt Q, Flt peakGain = 4)#

Configure the filter in one call.

Parameters:
  • type – Filter mode (low-pass, high-pass, peak, shelf, …).

  • frequency – Centre / cutoff frequency in Hz.

  • Q – Resonance.

  • peakGain – Peak gain in dB. Only meaningful for BQ_PEAK and the shelving modes.

biQuad &setType(BQ_TYPE type)#

Set the filter mode.

biQuad &setFreq(Flt frequency)#

Set the centre / cutoff frequency in Hz.

biQuad &setQ(Flt Q)#

Set the Q factor.

biQuad &setPeak(Flt peakGain)#

Set the peak gain in dB.

biQuad &setRaw(Flt fb1, Flt fb2, Flt ff1, Flt ff2, Flt ff3)#

Set the raw biquad coefficients directly.

Bypasses the parameter-to-coefficient mapping — useful when porting a filter design from elsewhere. Only for callers who know exactly what the coefficients mean.

virtual YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Protected Attributes

aFlt freq#
aFlt gain#
Flt q#
Flt last#
Flt previous#
aFlt coef1#
aFlt coef2#
aFlt ff1#
aFlt ff2#
aFlt ff3#
aFlt fb1#
aFlt fb2#
buffer samples#

Private Functions

void calc()#

Private Members

BQ_TYPE type#
class filterBase#

Common state shared by the simple one-pole filters.

Not intended to be instantiated directly — use highPass, lowPass, bandPass, or biQuad.

Subclassed by YSE::DSP::bandPass, YSE::DSP::biQuad, YSE::DSP::highPass, YSE::DSP::lowPass

Public Functions

filterBase()#
filterBase(const filterBase&)#
virtual ~filterBase() = default#
virtual buffer &operator()(buffer &in) = 0#

Process the buffer in place.

Protected Attributes

aFlt freq#
aFlt gain#
Flt q#
Flt last#
Flt previous#
aFlt coef1#
aFlt coef2#
aFlt ff1#
aFlt ff2#
aFlt ff3#
aFlt fb1#
aFlt fb2#
buffer samples#
class highPass : public YSE::DSP::filterBase#

Simple high-pass filter.

Attenuates frequencies below the cutoff. Reach for this when you need to remove low-frequency rumble or thin out a signal cheaply.

Public Functions

highPass &setFrequency(Flt f)#

Set the cutoff frequency in Hz.

virtual YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Protected Attributes

aFlt freq#
aFlt gain#
Flt q#
Flt last#
Flt previous#
aFlt coef1#
aFlt coef2#
aFlt ff1#
aFlt ff2#
aFlt ff3#
aFlt fb1#
aFlt fb2#
buffer samples#
class lowPass : public YSE::DSP::filterBase#

Simple low-pass filter.

Attenuates frequencies above the cutoff. Use for darkening, occlusion fakes, or anti-aliasing.

Public Functions

lowPass &setFrequency(Flt f)#

Set the cutoff frequency in Hz.

virtual YSE::DSP::buffer &operator()(YSE::DSP::buffer &in)#

Process in in place.

Protected Attributes

aFlt freq#
aFlt gain#
Flt q#
Flt last#
Flt previous#
aFlt coef1#
aFlt coef2#
aFlt ff1#
aFlt ff2#
aFlt ff3#
aFlt fb1#
aFlt fb2#
buffer samples#
class sampleHold#

Sample-and-hold gate.

When the control signal rises above a threshold, the latest input sample is captured and held in the output until the next trigger. Classic for stepped-pitch effects and quantised modulation.

Public Functions

sampleHold &reset(Flt value = 1e20)#

Reset the held value to value.

sampleHold &set(Flt value)#

Set the trigger threshold for the control signal.

YSE::DSP::buffer &operator()(YSE::DSP::buffer &in, YSE::DSP::buffer &signal)#

Process in gated by signal.

sampleHold()#

Private Members

aFlt lastIn#
aFlt lastOut#
YSE::DSP::buffer samples#

Delay#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

Functions

void readInterpolated(buffer &ctrl, buffer &out, buffer &buffer, UInt &pos)#

Read into out at interpolated positions ctrl from buffer.

Free function for tabular interpolation lookups — useful when reading from a buffer at fractional sample positions. < This macro is added to all public class declarations.

class delay#

Variable-length delay line.

Push audio in with process, then read it back at one or more offsets with read. The read offset can be a constant (fixed delay) or another buffer (per-sample modulated delay, useful for chorus, flanger, and Doppler-style effects).

Public Functions

delay &setSize(UInt size)#

Resize the delay line.

Longer lines use more memory but allow longer maximum delays.

delay &process(buffer &buffer)#

Write a block into the delay line.

Call once per audio processing tick. Must precede read calls for that tick.

delay &read(buffer &result, UInt delayTime)#

Read from the delay at a fixed offset.

Parameters:
  • result – Destination buffer for the delayed audio.

  • delayTime – Offset in samples from the most recent write.

delay &read(buffer &result, buffer &delayTime)#

Read from the delay at a per-sample variable offset.

Parameters:
  • result – Destination buffer for the delayed audio.

  • delayTime – Per-sample offsets in samples. Use this for modulated delays (chorus, flanger).

delay(Int size)#

Construct a delay line of the given initial size.

delay(const delay&)#

Private Members

UInt bufferlength#
std::vector<Flt> buffer#
Int phase#
UInt currentLength#
aUInt size#

Filter primitives#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class complexOnePole#

Complex one-pole IIR filter.

Operates on multichannel buffers: channel 0 carries the real part, channel 1 the imaginary part. Useful for building Hilbert transforms and other quadrature filters.

Public Functions

complexOnePole()#
std::vector<YSE::DSP::buffer> &operator()(std::vector<YSE::DSP::buffer> &in1, std::vector<YSE::DSP::buffer> &in2)#

Apply the complex one-pole filter.

Private Members

Flt lastReal#
Flt lastImaginary#
std::vector<YSE::DSP::buffer> out#
class complexOneZero#

Complex one-zero FIR filter.

See complexOnePole for the channel convention.

Public Functions

complexOneZero()#
std::vector<YSE::DSP::buffer> &operator()(std::vector<YSE::DSP::buffer> &in1, std::vector<YSE::DSP::buffer> &in2)#

Apply the complex one-zero filter.

Private Members

Flt lastReal#
Flt lastImaginary#
std::vector<YSE::DSP::buffer> out#
class complexOneZeroReversed#

Complex one-zero FIR with reversed sign.

See complexOnePole for the channel convention.

Public Functions

complexOneZeroReversed()#
std::vector<YSE::DSP::buffer> &operator()(std::vector<YSE::DSP::buffer> &in1, std::vector<YSE::DSP::buffer> &in2)#

Apply the reversed complex one-zero filter.

Private Members

Flt lastReal#
Flt lastImaginary#
std::vector<YSE::DSP::buffer> out#
class realOnePole#

Real-valued one-pole IIR filter.

Building block for low-level filter design. Takes a sample buffer and a per-sample feedback coefficient buffer.

Public Functions

inline realOnePole()#
buffer &operator()(buffer &in1, buffer &in2)#

Apply one-pole IIR: out[i] = in1[i] + in2[i] * out[i-1].

Private Members

Flt lastSample#
buffer out#
class realOneZero#

Real-valued one-zero FIR filter.

Building block: out[i] = in1[i] + in2[i] * in1[i-1].

Public Functions

inline realOneZero()#
buffer &operator()(buffer &in1, buffer &in2)#

Apply one-zero FIR.

Private Members

Flt lastSample#
buffer out#
class realOneZeroReversed#

Real-valued one-zero FIR with reversed feed-forward sign.

Building block: out[i] = in1[i] - in2[i] * in1[i-1].

Public Functions

inline realOneZeroReversed()#
buffer &operator()(buffer &in1, buffer &in2)#

Apply reversed one-zero FIR.

Private Members

Flt lastSample#
buffer out#

Interpolation#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class interpolate4#

4-point cubic interpolator.

Reads from a source buffer at fractional positions and produces smoothly interpolated output. Used internally for pitch-shifting and wavetable lookups; expose it directly when you need to resample or re-pitch a buffer at user-defined positions.

Public Functions

interpolate4()#
interpolate4 &source(buffer &data)#

Set the source buffer to read from.

buffer *source()#

Currently attached source buffer.

interpolate4 &onset(Int value)#

Set the read-offset relative to the start of the source.

Int onset()#

Current read-offset.

buffer &operator()(YSE::DSP::buffer &in)#

Resample in (treated as fractional positions) through the cubic kernel.

Private Members

buffer *data#
buffer out#
aInt parmOnset#

DSP base#

namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace DSP

Audio buffers, oscillators, filters, envelopes, and effect modules.

Build chains of DSP::dspObject to process a sound, DSP::dspSourceObject to feed one. Single-channel audio data lives in DSP::buffer and its drawing / file / wavetable subclasses.

class dspObject#

Base class for chainable DSP effects.

Subclass and implement create and process to define a custom effect that can be linked into a sound’s processing chain via YSE::sound::setDSP. The base class provides bypass control, a wet/dry impact slider, and a built-in LFO that can modulate the effect’s parameters.

Chain instances together with link: a.link(b); b.link(c);.

Subclassed by YSE::DSP::MODULES::bandPassFilter, YSE::DSP::MODULES::basicDelay, YSE::DSP::MODULES::difference, YSE::DSP::MODULES::granulator, YSE::DSP::MODULES::highPassFilter, YSE::DSP::MODULES::lowPassFilter, YSE::DSP::MODULES::phaser, YSE::DSP::MODULES::sweepFilter, YSE::DSP::ringModulator

Public Functions

dspObject()#
virtual ~dspObject()#
virtual void create() = 0#

One-time setup before processing starts.

Allocate buffers and any other heavyweight state here — never inside process. The engine calls create from a setup thread before the first process call.

virtual void process(std::vector<YSE::DSP::buffer> &buffer) = 0#

Process one audio block in place.

Runs on the audio thread. Must be allocation-free and reasonably bounded in time. Subclasses typically call createIfNeeded() at the start, do their work, then call calculateImpact() at the end to apply the wet/dry mix.

void link(dspObject &next)#

Insert next after this object in the processing chain.

If a downstream object is already linked, next is spliced between this object and the existing next.

dspObject *link()#

Next object in the processing chain, or nullptr if this is the tail.

inline dspObject &bypass(Bool value)#

Bypass this effect when true.

Bypassed effects still run but pass input through unchanged.

inline Bool bypass()#

Whether this effect is bypassed.

inline dspObject &impact(Flt value)#

Wet/dry mix in [0.0, 1.0].

0 is fully dry, 1 is fully processed.

inline Flt impact()#

Current wet/dry mix value.

inline dspObject &lfoType(LFO_TYPE type)#

Set the modulation LFO shape.

LFO_NONE disables modulation.

inline LFO_TYPE lfoType()#

Current LFO shape.

inline dspObject &lfoFrequency(Flt value)#

Set the LFO frequency in Hz.

inline Flt lfoFrequency()#

Current LFO frequency.

Public Members

dspObject **calledfrom#

Protected Functions

void createIfNeeded()#

Subclass helper: run create lazily on first process call.

buffer &getLFO()#

Subclass helper: access the current LFO buffer.

void calculateImpact(buffer &in, buffer &filtered)#

Subclass helper: apply the wet/dry mix between in and filtered.

Private Members

dspObject *next#
dspObject *previous#
Bool _bypass#
Bool _needsCreate#
aFlt _impact#
std::shared_ptr<lfo> lfoOsc#
std::shared_ptr<inverter> invertedImpact#
LFO_TYPE _lfoType#
aFlt _lfoFrequency#
class dspSourceObject#

Base class for DSP-driven sound sources.

Where dspObject is an effect, dspSourceObject is a generator — it produces audio rather than transforming it. Subclass and implement process and frequency to drive a YSE::sound from procedural audio (see YSE::sound::create for the lifetime contract).

Subclassed by YSE::DSP::sineWave

Public Functions

dspSourceObject(Int buffers = 1)#

Construct with buffers audio channels (1 = mono, 2 = stereo, …).

virtual void process(SOUND_STATUS &intent) = 0#

Fill samples with the next audio block.

Parameters:

intent – The current playback intent (start, stop, pause, etc.) — subclasses use this to drive amplitude envelopes and trigger transitions.

virtual void frequency(Flt value) = 0#

Set the fundamental frequency of the generator.

Public Members

std::vector<buffer> samples#

Output buffers, one per audio channel.