Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Namespaces | Functions | Variables
sbl::dsp::lut Namespace Reference

Lookup table functions. More...

Namespaces

namespace  detail
 

Functions

template<uint16_t Size>
uint16_t lookup_linear (const uint16_t *table, uint32_t phase)
 
uint16_t mix (uint16_t a, uint16_t b, uint16_t balance)
 
template<uint16_t Size>
float lookup_linear (const float *table, uint32_t phase)
 
template<uint16_t Size>
float lookup_cubic (const float *table, uint32_t phase)
 
template<uint16_t Size>
float crossfade (const float *table_a, const float *table_b, uint32_t phase, float balance)
 
float mix (float a, float b, float balance)
 

Variables

constexpr uint16_t exp_curve_256 [257]
 
constexpr uint16_t exp_curve_256_size = 256
 
constexpr float pitch_ratio_high_256 [257]
 
constexpr uint16_t pitch_ratio_high_256_size = 256
 
constexpr float pitch_ratio_low_256 [257]
 
constexpr uint16_t pitch_ratio_low_256_size = 256
 
constexpr float saw_256 [258]
 
constexpr uint16_t saw_256_size = 256
 
constexpr float sin_1024 [1026]
 
constexpr uint16_t sin_1024_size = 1024
 
constexpr float sin_256 [258]
 
constexpr uint16_t sin_256_size = 256
 
constexpr float square_256 [258]
 
constexpr uint16_t square_256_size = 256
 
constexpr float triangle_256 [258]
 
constexpr uint16_t triangle_256_size = 256
 

Detailed Description

Lookup table functions.

Interpolated lookup for LUTE-generated tables:

Function Documentation

◆ crossfade()

template<uint16_t Size>
float sbl::dsp::lut::crossfade ( const float table_a,
const float table_b,
uint32_t  phase,
float  balance 
)
inline

Definition at line 113 of file lut.hpp.

References lookup_linear().

Here is the call graph for this function:

◆ lookup_cubic()

template<uint16_t Size>
float sbl::dsp::lut::lookup_cubic ( const float table,
uint32_t  phase 
)
inline

Definition at line 84 of file lut.hpp.

References sbl::dsp::lut::detail::log2_of().

Here is the call graph for this function:

◆ lookup_linear() [1/2]

template<uint16_t Size>
float sbl::dsp::lut::lookup_linear ( const float *  table,
uint32_t  phase 
)
inline
Note
All functions in sbl::dsp::lut are ISR-safe — bounded computation, no I/O.

Definition at line 71 of file lut.hpp.

References sbl::dsp::lut::detail::log2_of().

Here is the call graph for this function:

◆ lookup_linear() [2/2]

template<uint16_t Size>
uint16_t sbl::dsp::lut::lookup_linear ( const uint16_t *  table,
uint32_t  phase 
)
inline

Definition at line 39 of file lut.hpp.

References sbl::dsp::FRAC16_MASK, and sbl::dsp::lut::detail::log2_of().

Referenced by crossfade(), sbl::dsp::lut_curve_warp(), mix(), sbl::widgets::source::ScanningOsc< TableSize, MaxTables >::process(), sbl::dsp::Waveshaper< Size >::process(), sbl::dsp::WavetableReader< Size >::read(), sbl::dsp::WavetableReader< Size >::read_block(), and sbl::dsp::WavetableReader< Size >::read_cubic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mix() [1/2]

float sbl::dsp::lut::mix ( float  a,
float  b,
float  balance 
)
inline

Definition at line 122 of file lut.hpp.

References lookup_linear().

Here is the call graph for this function:

◆ mix() [2/2]

uint16_t sbl::dsp::lut::mix ( uint16_t  a,
uint16_t  b,
uint16_t  balance 
)
inline

Definition at line 52 of file lut.hpp.

References sbl::dsp::U16_MAX.

Variable Documentation

◆ exp_curve_256

constexpr uint16_t sbl::dsp::lut::exp_curve_256[257]
inlineconstexpr
Initial value:
= {
0, 1039, 2062, 3069, 4060, 5036, 5996, 6942, 7873, 8790, 9692, 10580,
11454, 12315, 13162, 13997, 14818, 15626, 16422, 17205, 17977, 18736, 19483, 20219,
20943, 21656, 22358, 23049, 23730, 24399, 25059, 25708, 26346, 26975, 27595, 28204,
28804, 29395, 29976, 30549, 31112, 31667, 32213, 32751, 33280, 33801, 34314, 34819,
35316, 35806, 36287, 36762, 37228, 37688, 38140, 38586, 39024, 39456, 39881, 40299,
40711, 41116, 41515, 41908, 42295, 42676, 43051, 43420, 43783, 44140, 44492, 44839,
45180, 45516, 45846, 46172, 46492, 46808, 47118, 47424, 47725, 48021, 48313, 48600,
48882, 49161, 49434, 49704, 49969, 50231, 50488, 50741, 50990, 51236, 51477, 51715,
51949, 52180, 52407, 52630, 52850, 53066, 53280, 53489, 53696, 53899, 54099, 54296,
54490, 54681, 54869, 55054, 55236, 55416, 55592, 55766, 55937, 56105, 56271, 56434,
56595, 56753, 56909, 57062, 57213, 57362, 57508, 57652, 57794, 57933, 58070, 58206,
58339, 58470, 58599, 58726, 58851, 58974, 59095, 59214, 59332, 59447, 59561, 59673,
59783, 59892, 59999, 60104, 60207, 60309, 60410, 60509, 60606, 60702, 60796, 60889,
60980, 61070, 61158, 61246, 61331, 61416, 61499, 61581, 61661, 61741, 61819, 61896,
61971, 62046, 62119, 62191, 62262, 62332, 62401, 62469, 62536, 62602, 62666, 62730,
62793, 62854, 62915, 62975, 63034, 63092, 63149, 63205, 63260, 63315, 63368, 63421,
63473, 63524, 63574, 63624, 63673, 63721, 63768, 63814, 63860, 63905, 63950, 63993,
64037, 64079, 64121, 64162, 64202, 64242, 64281, 64319, 64357, 64395, 64432, 64468,
64503, 64539, 64573, 64607, 64641, 64673, 64706, 64738, 64769, 64800, 64831, 64861,
64890, 64919, 64948, 64976, 65004, 65031, 65058, 65084, 65110, 65136, 65161, 65186,
65211, 65235, 65258, 65282, 65305, 65327, 65350, 65372, 65393, 65414, 65435, 65456,
65476, 65496, 65516, 65535, 65535
}

Definition at line 10 of file exp_curve_256.hpp.

Referenced by sbl::dsp::ExpCurveWarp::warp().

◆ exp_curve_256_size

constexpr uint16_t sbl::dsp::lut::exp_curve_256_size = 256
inlineconstexpr

Definition at line 35 of file exp_curve_256.hpp.

◆ pitch_ratio_high_256

constexpr float sbl::dsp::lut::pitch_ratio_high_256[257]
inlineconstexpr

Definition at line 10 of file pitch_ratio_high_256.hpp.

Referenced by sbl::dsp::semitones_to_ratio().

◆ pitch_ratio_high_256_size

constexpr uint16_t sbl::dsp::lut::pitch_ratio_high_256_size = 256
inlineconstexpr

Definition at line 56 of file pitch_ratio_high_256.hpp.

◆ pitch_ratio_low_256

constexpr float sbl::dsp::lut::pitch_ratio_low_256[257]
inlineconstexpr

Definition at line 10 of file pitch_ratio_low_256.hpp.

Referenced by sbl::dsp::semitones_to_ratio().

◆ pitch_ratio_low_256_size

constexpr uint16_t sbl::dsp::lut::pitch_ratio_low_256_size = 256
inlineconstexpr

Definition at line 56 of file pitch_ratio_low_256.hpp.

◆ saw_256

constexpr float sbl::dsp::lut::saw_256[258]
inlineconstexpr

Definition at line 10 of file saw_256.hpp.

◆ saw_256_size

constexpr uint16_t sbl::dsp::lut::saw_256_size = 256
inlineconstexpr

Definition at line 56 of file saw_256.hpp.

◆ sin_1024

constexpr float sbl::dsp::lut::sin_1024[1026]
inlineconstexpr

Definition at line 10 of file sin_1024.hpp.

◆ sin_1024_size

constexpr uint16_t sbl::dsp::lut::sin_1024_size = 1024
inlineconstexpr

Definition at line 184 of file sin_1024.hpp.

◆ sin_256

constexpr float sbl::dsp::lut::sin_256[258]
inlineconstexpr

Definition at line 10 of file sin_256.hpp.

◆ sin_256_size

constexpr uint16_t sbl::dsp::lut::sin_256_size = 256
inlineconstexpr

Definition at line 56 of file sin_256.hpp.

◆ square_256

constexpr float sbl::dsp::lut::square_256[258]
inlineconstexpr

Definition at line 10 of file square_256.hpp.

◆ square_256_size

constexpr uint16_t sbl::dsp::lut::square_256_size = 256
inlineconstexpr

Definition at line 56 of file square_256.hpp.

◆ triangle_256

constexpr float sbl::dsp::lut::triangle_256[258]
inlineconstexpr

Definition at line 10 of file triangle_256.hpp.

◆ triangle_256_size

constexpr uint16_t sbl::dsp::lut::triangle_256_size = 256
inlineconstexpr

Definition at line 56 of file triangle_256.hpp.