LMMS
Loading...
Searching...
No Matches
dsp Namespace Reference

Classes

class  audio_effect
class  modulation_effect
class  simple_phaser
class  chorus_base
class  simple_chorus
class  simple_flanger
class  reverb
class  filter_module_iface
class  biquad_filter_module
class  two_band_eq
class  simple_lfo
class  lookahead_limiter
 Lookahead Limiter by Markus Schmidt and Christian Holschuh. More...
class  transients
class  crossover
class  bitreduction
class  resampleN
class  samplereduction
class  tap_distortion
class  overlap_window
class  median_stat
struct  benchmark_globals
class  simple_benchmark
class  biquad_coeffs
struct  biquad_d1
struct  biquad_d2
struct  biquad_d1_lerp
class  filter_compose
 Compose two filters in series. More...
class  filter_sum
 Compose two filters in parallel. More...
struct  sample_traits
struct  sample_traits< stereo_sample< T > >
class  fixed_size_buffer
class  mem_fixed_size_buffer
class  auto_buffer
class  dynamic_buffer
struct  buffer_traits
struct  buffer_traits< fixed_size_buffer< N, T > >
 this class template defines some basic position operations for fixed_size_buffers More...
class  circular_buffer
 this is useless for now (and untested too) More...
class  mono_auto_buffer
 this is useless for now More...
class  stereo_auto_buffer
 this is useless for now More...
class  bypass
struct  simple_delay
class  adsr
struct  fadeout
 Simple linear fade out for note tails. More...
class  fft
class  fixed_point
class  linear_ramp
 Algorithm for a constant time linear ramp. More...
class  exponential_ramp
 Algorithm for a constant time linear ramp. More...
class  inertia
class  once_per_n
class  gain_smoothing
class  switcher
class  aweighter
class  riaacurve
struct  modulation_entry
 Single entry in modulation matrix. More...
class  sine_multi_lfo
class  multichorus
class  onepole
struct  organ_parameters
class  organ_voice_base
class  organ_vibrato
 A simple (and bad) simulation of scanner vibrato based on a series of modulated allpass filters. More...
class  scanner_vibrato
class  organ_voice
class  percussion_voice
 Not a true voice, just something with similar-ish interface. More...
struct  drawbar_organ
struct  simple_oscillator
struct  bandlimiter
struct  waveform_family
 Set of bandlimited wavetables. More...
struct  waveform_oscillator
struct  triangle_lfo
struct  stereo_sample
class  decay
class  sine_table
struct  note_desc
class  keystack
class  voice
class  block_allvoices_base
class  block_voice
struct  basic_pool
 A basic preallocated var-array with append and. More...
struct  basic_synth
struct  vumeter
 Peak meter class. More...
struct  dual_vumeter
class  wave_player

Typedefs

typedef fixed_point< unsigned long long int, 24 > wpos
 wave position (unsigned 64-bit int including 24-bit fractional part)
typedef fixed_point< unsigned int, 20 > chorus_phase

Enumerations

enum  periodic_unit { UNIT_BPM , UNIT_MS , UNIT_HZ , UNIT_SYNC }

Functions

template<class T>
void do_simple_benchmark (int runs=5, int repeats=50000)
template<int N>
int wrap_around (int a)
 decrease by N if >= N (useful for circular buffers)
template<>
int wrap_around< 2 > (int a)
template<>
int wrap_around< 4 > (int a)
template<>
int wrap_around< 8 > (int a)
template<>
int wrap_around< 16 > (int a)
template<>
int wrap_around< 32 > (int a)
template<>
int wrap_around< 64 > (int a)
template<>
int wrap_around< 128 > (int a)
template<>
int wrap_around< 256 > (int a)
template<>
int wrap_around< 512 > (int a)
template<>
int wrap_around< 1024 > (int a)
template<>
int wrap_around< 2048 > (int a)
template<>
int wrap_around< 4096 > (int a)
template<>
int wrap_around< 8192 > (int a)
template<>
int wrap_around< 16384 > (int a)
template<>
int wrap_around< 32768 > (int a)
template<>
int wrap_around< 65536 > (int a)
template<class Buf, class T>
void fill (Buf &buf, T value)
template<class T>
void fill (T *data, int size, T value)
template<class T, class U>
void copy (T *dest, U *src, int size, T scale=1, T add=0)
template<class T, class U>
void copy_buf (T &dest_buf, const U &src_buf, T scale=1, T add=0)
uint32_t shr (uint32_t v, int bits=1)
int32_t shr (int32_t v, int bits=1)
uint64_t shr (uint64_t v, int bits=1)
int64_t shr (int64_t v, int bits=1)
float shr (float v, int bits=1)
double shr (double v, int bits=1)
template<class T, int FracBits>
shr (T v, int bits=1)
template<class T, int FractBits>
fixed_point< T, FractBits > operator* (int v, fixed_point< T, FractBits > v2)
static void normalize_waveform (float *table, unsigned int size)
 Simple stupid inline function to normalize a waveform (by removing DC offset and ensuring max absolute value of 1).
void zero (float &v)
 Set a float to zero.
void zero (double &v)
 Set a double to zero.
void zero (uint64_t &v)
 Set 64-bit unsigned integer value to zero.
void zero (uint32_t &v)
 Set 32-bit unsigned integer value to zero.
void zero (uint16_t &v)
 Set 16-bit unsigned integer value to zero.
void zero (uint8_t &v)
 Set 8-bit unsigned integer value to zero.
void zero (int64_t &v)
 Set 64-bit signed integer value to zero.
void zero (int32_t &v)
 Set 32-bit signed integer value to zero.
void zero (int16_t &v)
 Set 16-bit signed integer value to zero.
void zero (int8_t &v)
 Set 8-bit signed integer value to zero.
template<class T>
void zero (T *data, unsigned int size)
 Set array (buffer or anything similar) to vector of zeroes.
template<class T>
void fill (T *data, T value, unsigned int size)
 Set array (buffer or anything similar) to vector of values.
template<class T>
stereo_sample< T > operator* (const T &value, const stereo_sample< T > &value2)
 Multiply constant by stereo_value.
template<class T>
stereo_sample< T > operator+ (const T &value, const stereo_sample< T > &value2)
 Add constant to stereo_value.
template<class T>
stereo_sample< T > operator- (const T &value, const stereo_sample< T > &value2)
 Subtract stereo_value from constant (yields stereo_value of course).
template<typename T>
stereo_sample< T > shr (stereo_sample< T > v, int bits=1)
 Shift value right by 'bits' bits (multiply by 2^-bits).
template<typename T>
void zero (stereo_sample< T > &v)
 Set a stereo_sample<T> value to zero.
template<typename T>
small_value ()
 'Small value' for integer and other types
template<>
float small_value< float > ()
 'Small value' for floats (2^-24) - used for primitive underrun prevention. The value is pretty much arbitrary (allowing for 24-bit signals normalized to 1.0).
template<>
double small_value< double > ()
 'Small value' for doubles (2^-24) - used for primitive underrun prevention. The value is pretty much arbitrary.
template<typename T>
float mono (T v)
 Convert a single value to single value = do nothing :) (but it's a generic with specialisation for stereo_sample).
template<typename T>
mono (stereo_sample< T > v)
 Convert a stereo_sample to single value by averaging two channels.
template<typename T>
clip (T value, T min, T max)
 Clip a value to [min, max].
double clip11 (double value)
 Clip a double to [-1.0, +1.0].
float clip11 (float value)
 Clip a float to [-1.0f, +1.0f].
double clip01 (double value)
 Clip a double to [0.0, +1.0].
float clip01 (float value)
 Clip a float to [0.0f, +1.0f].
template<typename T, typename U>
lerp (T v1, T v2, U mix)
template<typename T>
stereo_sample< T > lerp (stereo_sample< T > &v1, stereo_sample< T > &v2, float mix)
void sanitize (float &value)
float _sanitize (float value)
void sanitize_denormal (float &value)
void sanitize_denormal (double &value)
void sanitize (double &value)
double _sanitize (double value)
template<class T>
void sanitize (stereo_sample< T > &value)
float fract16 (unsigned int value)
int fastf2i_drm (float f)
 fast float to int conversion using default rounding mode
float note_to_hz (double note, double detune_cents=0.0)
 Convert MIDI note to frequency in Hz.
float normalized_hermite (float t, float p0, float p1, float m0, float m1)
float hermite_interpolation (float x, float x0, float x1, float p0, float p1, float m0, float m1)
float amp2dB (float amp)
 convert amplitude value to dB
float dB2amp (float db)
 convert dB to amplitude value
void print_bits (size_t const size, void const *const ptr)
note_desc hz_to_note (double hz, double tune)
double convert_periodic (double val, periodic_unit unit_in, periodic_unit unit_out)
unsigned int midi_note_to_phase (int note, double cents, int sr)
template<class T>
bool load_wave (dsp::dynamic_buffer< T > &dest, const char *file_name)

Variables

template<class T, int N, int Multiplier>
bool sine_table< T, N, Multiplier >::initialized = false
template<class T, int N, int Multiplier>
sine_table< T, N, Multiplier >::data [N+1]

Typedef Documentation

◆ chorus_phase

typedef fixed_point<unsigned int, 20> dsp::chorus_phase

◆ wpos

typedef fixed_point<unsigned long long int, 24> dsp::wpos

wave position (unsigned 64-bit int including 24-bit fractional part)

Enumeration Type Documentation

◆ periodic_unit

Enumerator
UNIT_BPM 
UNIT_MS 
UNIT_HZ 
UNIT_SYNC 

Function Documentation

◆ _sanitize() [1/2]

double dsp::_sanitize ( double value)
inline

◆ _sanitize() [2/2]

float dsp::_sanitize ( float value)
inline

◆ amp2dB()

float dsp::amp2dB ( float amp)
inline

convert amplitude value to dB

◆ clip()

template<typename T>
T dsp::clip ( T value,
T min,
T max )
inline

Clip a value to [min, max].

◆ clip01() [1/2]

double dsp::clip01 ( double value)
inline

Clip a double to [0.0, +1.0].

◆ clip01() [2/2]

float dsp::clip01 ( float value)
inline

Clip a float to [0.0f, +1.0f].

◆ clip11() [1/2]

double dsp::clip11 ( double value)
inline

Clip a double to [-1.0, +1.0].

◆ clip11() [2/2]

float dsp::clip11 ( float value)
inline

Clip a float to [-1.0f, +1.0f].

◆ convert_periodic()

double dsp::convert_periodic ( double val,
periodic_unit unit_in,
periodic_unit unit_out )
inline

◆ copy()

template<class T, class U>
void dsp::copy ( T * dest,
U * src,
int size,
T scale = 1,
T add = 0 )

◆ copy_buf()

template<class T, class U>
void dsp::copy_buf ( T & dest_buf,
const U & src_buf,
T scale = 1,
T add = 0 )

◆ dB2amp()

float dsp::dB2amp ( float db)
inline

convert dB to amplitude value

◆ do_simple_benchmark()

template<class T>
void dsp::do_simple_benchmark ( int runs = 5,
int repeats = 50000 )

◆ fastf2i_drm()

int dsp::fastf2i_drm ( float f)
inline

fast float to int conversion using default rounding mode

◆ fill() [1/3]

template<class Buf, class T>
void dsp::fill ( Buf & buf,
T value )

◆ fill() [2/3]

template<class T>
void dsp::fill ( T * data,
int size,
T value )

◆ fill() [3/3]

template<class T>
void dsp::fill ( T * data,
T value,
unsigned int size )

Set array (buffer or anything similar) to vector of values.

◆ fract16()

float dsp::fract16 ( unsigned int value)
inline

◆ hermite_interpolation()

float dsp::hermite_interpolation ( float x,
float x0,
float x1,
float p0,
float p1,
float m0,
float m1 )
inline

Hermite interpolation between two points and slopes

  • x point within interval (x0 <= x <= x1)
  • x0 interval start
  • x1 interval end
  • p0 value at x0
  • p1 value at x1
  • m0 slope (steepness, tangent) at x0
  • m1 slope at x1

◆ hz_to_note()

note_desc dsp::hz_to_note ( double hz,
double tune )
inline

◆ lerp() [1/2]

template<typename T>
stereo_sample< T > dsp::lerp ( stereo_sample< T > & v1,
stereo_sample< T > & v2,
float mix )
inline

◆ lerp() [2/2]

template<typename T, typename U>
T dsp::lerp ( T v1,
T v2,
U mix )
inline

◆ load_wave()

template<class T>
bool dsp::load_wave ( dsp::dynamic_buffer< T > & dest,
const char * file_name )

◆ midi_note_to_phase()

unsigned int dsp::midi_note_to_phase ( int note,
double cents,
int sr )
inline

Convert MIDI note number to normalized UINT phase (where 1<<32 is full cycle).

Parameters
MIDInote number
centsdetune in cents (1/100 of a semitone)
srsample rate

◆ mono() [1/2]

template<typename T>
T dsp::mono ( stereo_sample< T > v)
inline

Convert a stereo_sample to single value by averaging two channels.

◆ mono() [2/2]

template<typename T>
float dsp::mono ( T v)
inline

Convert a single value to single value = do nothing :) (but it's a generic with specialisation for stereo_sample).

◆ normalize_waveform()

void dsp::normalize_waveform ( float * table,
unsigned int size )
inlinestatic

Simple stupid inline function to normalize a waveform (by removing DC offset and ensuring max absolute value of 1).

◆ normalized_hermite()

float dsp::normalized_hermite ( float t,
float p0,
float p1,
float m0,
float m1 )
inline

Hermite interpolation between two points and slopes in normalized range (written after Wikipedia article)

  • t normalized x coordinate (0-1 over the interval in question)
  • p0 first point
  • p1 second point
  • m0 first slope (multiply by interval width when using over non-1-wide interval)
  • m1 second slope (multiply by interval width when using over non-1-wide interval)

◆ note_to_hz()

float dsp::note_to_hz ( double note,
double detune_cents = 0.0 )
inline

Convert MIDI note to frequency in Hz.

◆ operator*() [1/2]

template<class T>
stereo_sample< T > dsp::operator* ( const T & value,
const stereo_sample< T > & value2 )
inline

Multiply constant by stereo_value.

◆ operator*() [2/2]

template<class T, int FractBits>
fixed_point< T, FractBits > dsp::operator* ( int v,
fixed_point< T, FractBits > v2 )
inline

◆ operator+()

template<class T>
stereo_sample< T > dsp::operator+ ( const T & value,
const stereo_sample< T > & value2 )
inline

Add constant to stereo_value.

◆ operator-()

template<class T>
stereo_sample< T > dsp::operator- ( const T & value,
const stereo_sample< T > & value2 )
inline

Subtract stereo_value from constant (yields stereo_value of course).

◆ print_bits()

void dsp::print_bits ( size_t const size,
void const *const ptr )
inline

print binary of any data type assumes little endian

◆ sanitize() [1/3]

void dsp::sanitize ( double & value)
inline

Force "small enough" double value to zero

◆ sanitize() [2/3]

void dsp::sanitize ( float & value)
inline

Force "small enough" float value to zero

◆ sanitize() [3/3]

template<class T>
void dsp::sanitize ( stereo_sample< T > & value)
inline

Force "small enough" stereo value to zero

◆ sanitize_denormal() [1/2]

void dsp::sanitize_denormal ( double & value)
inline

Force already-denormal float value to zero

◆ sanitize_denormal() [2/2]

void dsp::sanitize_denormal ( float & value)
inline

Force already-denormal float value to zero

◆ shr() [1/8]

double dsp::shr ( double v,
int bits = 1 )
inline

◆ shr() [2/8]

float dsp::shr ( float v,
int bits = 1 )
inline

◆ shr() [3/8]

int32_t dsp::shr ( int32_t v,
int bits = 1 )
inline

◆ shr() [4/8]

int64_t dsp::shr ( int64_t v,
int bits = 1 )
inline

◆ shr() [5/8]

template<typename T>
stereo_sample< T > dsp::shr ( stereo_sample< T > v,
int bits = 1 )
inline

Shift value right by 'bits' bits (multiply by 2^-bits).

◆ shr() [6/8]

template<class T, int FracBits>
T dsp::shr ( T v,
int bits = 1 )
inline

◆ shr() [7/8]

uint32_t dsp::shr ( uint32_t v,
int bits = 1 )
inline

◆ shr() [8/8]

uint64_t dsp::shr ( uint64_t v,
int bits = 1 )
inline

◆ small_value()

template<typename T>
T dsp::small_value ( )
inline

'Small value' for integer and other types

◆ small_value< double >()

template<>
double dsp::small_value< double > ( )
inline

'Small value' for doubles (2^-24) - used for primitive underrun prevention. The value is pretty much arbitrary.

◆ small_value< float >()

template<>
float dsp::small_value< float > ( )
inline

'Small value' for floats (2^-24) - used for primitive underrun prevention. The value is pretty much arbitrary (allowing for 24-bit signals normalized to 1.0).

◆ wrap_around()

template<int N>
int dsp::wrap_around ( int a)
inline

decrease by N if >= N (useful for circular buffers)

◆ wrap_around< 1024 >()

template<>
int dsp::wrap_around< 1024 > ( int a)
inline

◆ wrap_around< 128 >()

template<>
int dsp::wrap_around< 128 > ( int a)
inline

◆ wrap_around< 16 >()

template<>
int dsp::wrap_around< 16 > ( int a)
inline

◆ wrap_around< 16384 >()

template<>
int dsp::wrap_around< 16384 > ( int a)
inline

◆ wrap_around< 2 >()

template<>
int dsp::wrap_around< 2 > ( int a)
inline

◆ wrap_around< 2048 >()

template<>
int dsp::wrap_around< 2048 > ( int a)
inline

◆ wrap_around< 256 >()

template<>
int dsp::wrap_around< 256 > ( int a)
inline

◆ wrap_around< 32 >()

template<>
int dsp::wrap_around< 32 > ( int a)
inline

◆ wrap_around< 32768 >()

template<>
int dsp::wrap_around< 32768 > ( int a)
inline

◆ wrap_around< 4 >()

template<>
int dsp::wrap_around< 4 > ( int a)
inline

◆ wrap_around< 4096 >()

template<>
int dsp::wrap_around< 4096 > ( int a)
inline

◆ wrap_around< 512 >()

template<>
int dsp::wrap_around< 512 > ( int a)
inline

◆ wrap_around< 64 >()

template<>
int dsp::wrap_around< 64 > ( int a)
inline

◆ wrap_around< 65536 >()

template<>
int dsp::wrap_around< 65536 > ( int a)
inline

◆ wrap_around< 8 >()

template<>
int dsp::wrap_around< 8 > ( int a)
inline

◆ wrap_around< 8192 >()

template<>
int dsp::wrap_around< 8192 > ( int a)
inline

◆ zero() [1/12]

void dsp::zero ( double & v)
inline

Set a double to zero.

◆ zero() [2/12]

void dsp::zero ( float & v)
inline

Set a float to zero.

◆ zero() [3/12]

void dsp::zero ( int16_t & v)
inline

Set 16-bit signed integer value to zero.

◆ zero() [4/12]

void dsp::zero ( int32_t & v)
inline

Set 32-bit signed integer value to zero.

◆ zero() [5/12]

void dsp::zero ( int64_t & v)
inline

Set 64-bit signed integer value to zero.

◆ zero() [6/12]

void dsp::zero ( int8_t & v)
inline

Set 8-bit signed integer value to zero.

◆ zero() [7/12]

template<typename T>
void dsp::zero ( stereo_sample< T > & v)
inline

Set a stereo_sample<T> value to zero.

◆ zero() [8/12]

template<class T>
void dsp::zero ( T * data,
unsigned int size )

Set array (buffer or anything similar) to vector of zeroes.

◆ zero() [9/12]

void dsp::zero ( uint16_t & v)
inline

Set 16-bit unsigned integer value to zero.

◆ zero() [10/12]

void dsp::zero ( uint32_t & v)
inline

Set 32-bit unsigned integer value to zero.

◆ zero() [11/12]

void dsp::zero ( uint64_t & v)
inline

Set 64-bit unsigned integer value to zero.

◆ zero() [12/12]

void dsp::zero ( uint8_t & v)
inline

Set 8-bit unsigned integer value to zero.

Variable Documentation

◆ sine_table< T, N, Multiplier >::data

template<class T, int N, int Multiplier>
T dsp::sine_table< T, N, Multiplier >::data[N+1]

◆ sine_table< T, N, Multiplier >::initialized

template<class T, int N, int Multiplier>
bool dsp::sine_table< T, N, Multiplier >::initialized = false