dplug.core.math

DSP utility functions. They are a range of math function usual in DSP.

Members

Aliases

fast_ceil
alias fast_ceil = llvm_ceil
Undocumented in source.
fast_ceil
alias fast_ceil = ceil
Undocumented in source.
fast_cos
alias fast_cos = llvm_cos
Undocumented in source.
fast_cos
alias fast_cos = cos
Undocumented in source.
fast_exp
alias fast_exp = llvm_exp
Undocumented in source.
fast_exp
alias fast_exp = exp
Undocumented in source.
fast_exp2
alias fast_exp2 = llvm_exp2
Undocumented in source.
fast_exp2
alias fast_exp2 = exp2
Undocumented in source.
fast_fabs
alias fast_fabs = llvm_fabs
Undocumented in source.
fast_fabs
alias fast_fabs = fabs
Undocumented in source.
fast_floor
alias fast_floor = llvm_floor
Undocumented in source.
fast_floor
alias fast_floor = floor
Undocumented in source.
fast_log
alias fast_log = llvm_log
Undocumented in source.
fast_log
alias fast_log = log
Undocumented in source.
fast_log10
alias fast_log10 = llvm_log10
Undocumented in source.
fast_log10
alias fast_log10 = log10
Undocumented in source.
fast_log2
alias fast_log2 = llvm_log2
Undocumented in source.
fast_log2
alias fast_log2 = log2
Undocumented in source.
fast_pow
alias fast_pow = llvm_pow
Undocumented in source.
fast_pow
alias fast_pow = pow
Undocumented in source.
fast_round
alias fast_round = llvm_round
Undocumented in source.
fast_round
alias fast_round = round
Undocumented in source.
fast_sin
alias fast_sin = llvm_sin
Undocumented in source.
fast_sin
alias fast_sin = sin
Undocumented in source.
fast_sqrt
alias fast_sqrt = llvm_sqrt
Undocumented in source.
fast_sqrt
alias fast_sqrt = sqrt
Undocumented in source.
fast_trunc
alias fast_trunc = llvm_trunc
Undocumented in source.
fast_trunc
alias fast_trunc = trunc
Undocumented in source.
hermite
deprecated alias hermite = hermiteInterp
Undocumented in source.

Functions

computeRMS
deprecated T computeRMS(T[] samples)
Undocumented in source. Be warned that the author may not have intended to support it.
convertDecibelToLinearGain
float convertDecibelToLinearGain(float dB)
double convertDecibelToLinearGain(double dB)

Converts from decibels (dB) to linear gain (aka. voltage).

convertFrequencyToMIDINote
float convertFrequencyToMIDINote(float frequency)

Map from frequency (Hz) to MIDI notes.

convertFrequencyToNormalizedFrequency
deprecated float convertFrequencyToNormalizedFrequency(float frequencyHz, float samplingRate)
Undocumented in source. Be warned that the author may not have intended to support it.
convertLinearGainToDecibel
float convertLinearGainToDecibel(float x)
double convertLinearGainToDecibel(double x)

Converts from linear gain (voltage) to decibels (dB).

convertMIDINoteToFrequency
float convertMIDINoteToFrequency(float note)

Map from MIDI notes to frequency (Hz).

convertNormalizedFrequencyToFrequency
deprecated float convertNormalizedFrequencyToFrequency(float freqCyclesPerSample, float samplingRate)
Undocumented in source. Be warned that the author may not have intended to support it.
convertPowerToDecibel
float convertPowerToDecibel(float x)
double convertPowerToDecibel(double x)

Converts a power value to decibels (dB).

equalLoudnessCurve
deprecated T equalLoudnessCurve(T frequency)

Fletcher and Munson equal-loudness curve Reference: Xavier Serra thesis (1989).

expDecayFactor
double expDecayFactor(double timeConstantSecs, double samplerate)

Gets a factor for making exponential decay curves, which are also the same thing as a 6dB/oct lowpass filter.

hermiteInterp
T hermiteInterp(T f_pos, T xm1, T x0, T x1, T x2)

Hermite interpolation.

iFloorLog2
deprecated int iFloorLog2(int i)

Integer log, rounds towards -inf.

inverseSqrt
deprecated T inverseSqrt(T x)

SSE approximation of reciprocal square root.

isEven
deprecated bool isEven(T i)

Is this integer even?

isOdd
deprecated bool isOdd(T i)

Is this integer odd?

isPowerOfTwo
bool isPowerOfTwo(int i)
lerp
S lerp(S a, S b, T t)

Linear interpolation, akin to GLSL's mix.

linmap
T linmap(T value, T a, T b, T c, T d)

Map linearly x from the range [a, b] to the range [c, d].

logmap
T logmap(T t, T min, T max)

Map the [0..1] range to [min..max] logarithmically.

nextMultipleOf
size_t nextMultipleOf(size_t n, size_t powerOfTwo)

Compute the next higher multiple of a pow^2 number.

nextPow2HigherOrEqual
int nextPow2HigherOrEqual(int i)
long nextPow2HigherOrEqual(long i)

Computes next power of 2.

normalizePhase
T normalizePhase(T phase)

Give back a phase between -PI and PI

rawSawtooth
deprecated T rawSawtooth(T x)

Quick and dirty sawtooth for testing purposes.

rawSquare
deprecated T rawSquare(T x)

Quick and dirty square for testing purposes.

rawTriangle
deprecated T rawTriangle(T x)

Quick and dirty triangle for testing purposes.

sinc
T sinc(T x)

Normalized sinc function.

smoothStep
T smoothStep(T a, T b, T t)

Same as GLSL smoothstep function. See: http://en.wikipedia.org/wiki/Smoothstep

Variables

TAU
real TAU;

TAU is two times PI.

Meta