DSPark 1.9.0
Header-only C++20 DSP for real-time and offline audio
Loading...
Searching...
No Matches
dspark::LoFi< T > Class Template Reference

Grains, fold, sample rate and bit depth, each off by default. More...

#include <LoFi.h>

Public Member Functions

 LoFi ()
 
void prepare (const AudioSpec &spec)
 Prepares every stage. Invalid specs are ignored; allocates (setup thread).
 
void reset () noexcept
 Clears every stage's memory.
 
void processBlock (AudioBufferView< T > buffer) noexcept
 Processes a block in place. Pass-through until prepare() succeeds.
 
void setSmear (T amount) noexcept
 How far the grains' read position wanders, 0 to 1 (0, the default, with no pitch: no grains).
 
void setPitch (T semitones) noexcept
 Pitch of the grains in semitones, -24 to +12 (0, the default, with no smear: no grains).
 
void setFold (T dB) noexcept
 Fold gain in dB, 0 to 36; 0, the default, is off (see the file notes).
 
void setRate (T hz) noexcept
 Sample rate of the hold in hertz, from 100; at or above the stream's rate, the default, it is off.
 
void setRateFilter (bool on) noexcept
 A 48 dB per octave low-pass at 0.45 of the rate in front of the hold (off by default).
 
void setBits (T bits) noexcept
 Bit depth, 1 to 24 (fractional values too); 24, the default, is off.
 
void setDither (bool on) noexcept
 Triangular dither of one step before the rounding (off by default).
 
void setMix (T mix) noexcept
 Dry/wet mix, 0 to 1 (default 1); glides over 20 ms.
 
void setOutput (T dB) noexcept
 Output gain in dB, -24 to +12 (default 0); glides over 20 ms.
 
T getSmear () const noexcept
 
T getPitch () const noexcept
 
T getFold () const noexcept
 
T getRate () const noexcept
 
bool isRateFilter () const noexcept
 
T getBits () const noexcept
 
bool isDither () const noexcept
 
T getMix () const noexcept
 
T getOutput () const noexcept
 
std::vector< uint8_t > getState () const
 Serializes the settings.
 
bool setState (const uint8_t *data, size_t size)
 Restores what getState() wrote.
 

Static Public Member Functions

static constexpr int getLatency () noexcept
 No latency at any setting.
 

Static Public Attributes

static constexpr int kMaxChannels = 16
 

Detailed Description

template<FloatType T>
class dspark::LoFi< T >

Grains, fold, sample rate and bit depth, each off by default.

Template Parameters
TSample type (float or double).

Definition at line 72 of file LoFi.h.

Constructor & Destructor Documentation

◆ LoFi()

template<FloatType T>
dspark::LoFi< T >::LoFi ( )
inline

Definition at line 77 of file LoFi.h.

Member Function Documentation

◆ getBits()

template<FloatType T>
T dspark::LoFi< T >::getBits ( ) const
inlinenoexcept

Definition at line 156 of file LoFi.h.

◆ getFold()

template<FloatType T>
T dspark::LoFi< T >::getFold ( ) const
inlinenoexcept

Definition at line 153 of file LoFi.h.

◆ getLatency()

template<FloatType T>
static constexpr int dspark::LoFi< T >::getLatency ( )
inlinestaticconstexprnoexcept

No latency at any setting.

Definition at line 162 of file LoFi.h.

◆ getMix()

template<FloatType T>
T dspark::LoFi< T >::getMix ( ) const
inlinenoexcept

Definition at line 158 of file LoFi.h.

◆ getOutput()

template<FloatType T>
T dspark::LoFi< T >::getOutput ( ) const
inlinenoexcept

Definition at line 159 of file LoFi.h.

◆ getPitch()

template<FloatType T>
T dspark::LoFi< T >::getPitch ( ) const
inlinenoexcept

Definition at line 152 of file LoFi.h.

◆ getRate()

template<FloatType T>
T dspark::LoFi< T >::getRate ( ) const
inlinenoexcept

Definition at line 154 of file LoFi.h.

◆ getSmear()

template<FloatType T>
T dspark::LoFi< T >::getSmear ( ) const
inlinenoexcept

Definition at line 151 of file LoFi.h.

◆ getState()

template<FloatType T>
std::vector< uint8_t > dspark::LoFi< T >::getState ( ) const
inline

Serializes the settings.

Definition at line 165 of file LoFi.h.

◆ isDither()

template<FloatType T>
bool dspark::LoFi< T >::isDither ( ) const
inlinenoexcept

Definition at line 157 of file LoFi.h.

◆ isRateFilter()

template<FloatType T>
bool dspark::LoFi< T >::isRateFilter ( ) const
inlinenoexcept

Definition at line 155 of file LoFi.h.

◆ prepare()

template<FloatType T>
void dspark::LoFi< T >::prepare ( const AudioSpec &  spec)
inline

Prepares every stage. Invalid specs are ignored; allocates (setup thread).

Definition at line 80 of file LoFi.h.

◆ processBlock()

template<FloatType T>
void dspark::LoFi< T >::processBlock ( AudioBufferView< T >  buffer)
inlinenoexcept

Processes a block in place. Pass-through until prepare() succeeds.

Definition at line 117 of file LoFi.h.

◆ reset()

template<FloatType T>
void dspark::LoFi< T >::reset ( )
inlinenoexcept

Clears every stage's memory.

Definition at line 101 of file LoFi.h.

◆ setBits()

template<FloatType T>
void dspark::LoFi< T >::setBits ( T  bits)
inlinenoexcept

Bit depth, 1 to 24 (fractional values too); 24, the default, is off.

Definition at line 143 of file LoFi.h.

◆ setDither()

template<FloatType T>
void dspark::LoFi< T >::setDither ( bool  on)
inlinenoexcept

Triangular dither of one step before the rounding (off by default).

Definition at line 145 of file LoFi.h.

◆ setFold()

template<FloatType T>
void dspark::LoFi< T >::setFold ( T  dB)
inlinenoexcept

Fold gain in dB, 0 to 36; 0, the default, is off (see the file notes).

Definition at line 133 of file LoFi.h.

◆ setMix()

template<FloatType T>
void dspark::LoFi< T >::setMix ( T  mix)
inlinenoexcept

Dry/wet mix, 0 to 1 (default 1); glides over 20 ms.

Definition at line 147 of file LoFi.h.

◆ setOutput()

template<FloatType T>
void dspark::LoFi< T >::setOutput ( T  dB)
inlinenoexcept

Output gain in dB, -24 to +12 (default 0); glides over 20 ms.

Definition at line 149 of file LoFi.h.

◆ setPitch()

template<FloatType T>
void dspark::LoFi< T >::setPitch ( T  semitones)
inlinenoexcept

Pitch of the grains in semitones, -24 to +12 (0, the default, with no smear: no grains).

Definition at line 131 of file LoFi.h.

◆ setRate()

template<FloatType T>
void dspark::LoFi< T >::setRate ( T  hz)
inlinenoexcept

Sample rate of the hold in hertz, from 100; at or above the stream's rate, the default, it is off.

Definition at line 135 of file LoFi.h.

◆ setRateFilter()

template<FloatType T>
void dspark::LoFi< T >::setRateFilter ( bool  on)
inlinenoexcept

A 48 dB per octave low-pass at 0.45 of the rate in front of the hold (off by default).

Definition at line 141 of file LoFi.h.

◆ setSmear()

template<FloatType T>
void dspark::LoFi< T >::setSmear ( T  amount)
inlinenoexcept

How far the grains' read position wanders, 0 to 1 (0, the default, with no pitch: no grains).

Definition at line 129 of file LoFi.h.

◆ setState()

template<FloatType T>
bool dspark::LoFi< T >::setState ( const uint8_t *  data,
size_t  size 
)
inline

Restores what getState() wrote.

Definition at line 181 of file LoFi.h.

Member Data Documentation

◆ kMaxChannels

template<FloatType T>
constexpr int dspark::LoFi< T >::kMaxChannels = 16
staticconstexpr

Definition at line 75 of file LoFi.h.


The documentation for this class was generated from the following file: