dplug.core.math

Members

Aliases

MIDIToFrequency
deprecated alias MIDIToFrequency = convertMIDINoteToFrequency

Mapping from MIDI notes to frequency

frequencyToMIDI
deprecated alias frequencyToMIDI = convertFrequencyToMIDINote

Mapping from frequency to MIDI notes

Functions

computeRMS
T computeRMS(T[] samples)
Undocumented in source. Be warned that the author may not have intended to support it.
convertFrequencyToMIDINote
T convertFrequencyToMIDINote(T frequency)
Undocumented in source. Be warned that the author may not have intended to support it.
convertFrequencyToNormalizedFrequency
float convertFrequencyToNormalizedFrequency(float frequencyHz, float samplingRate)

Computes a normalized frequency form a frequency.

convertMIDINoteToFrequency
T convertMIDINoteToFrequency(T note)
Undocumented in source. Be warned that the author may not have intended to support it.
convertNormalizedFreqyencyToFrequency
float convertNormalizedFreqyencyToFrequency(float frequencyCyclesPerSample, float samplingRate)

Computes a frequency.

deciBelToFloat
T deciBelToFloat(T dB)

Convert from dB to float.

equalLoudnessCurve
T equalLoudnessCurve(T frequency)

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

expDecayFactor
double expDecayFactor(double timeConstantInSeconds, double samplerate)
fast_ceil
T fast_ceil(T val)
fast_exp
T fast_exp(T val, T )
fast_exp2
T fast_exp2(T val)
fast_floor
T fast_floor(T val)
fast_log
T fast_log(T val)
fast_log10
T fast_log10(T val)
fast_log2
T fast_log2(T val)
fast_pow
T fast_pow(T val, T power)
fast_round
T fast_round(T val)
fast_trunc
T fast_trunc(T val)
floatToDeciBel
T floatToDeciBel(T x)

Convert from float to dB

hermite
T hermite(T frac_pos, T xm1, T x0, T x1, T x2)

Hermite interpolation.

iFloorLog2
int iFloorLog2(int i)
inverseSqrt
T inverseSqrt(T x)

SSE approximation of reciprocal square root.

isEven
bool isEven(T i)

Is this integer even?

isOdd
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 [0..1] to min..max logarithmically min and max must be all > 0, t in [0..1]

nextPowerOf2
int nextPowerOf2(int i)

Computes next power of 2.

nextPowerOf2
long nextPowerOf2(long i)

Computes next power of 2.

normalizePhase
T normalizePhase(T phase)

Give back a phase between -PI and PI

rawSawtooth
T rawSawtooth(T x)

Quick and dirty sawtooth for testing purposes.

rawSquare
T rawSquare(T x)

Quick and dirty square for testing purposes.

rawTriangle
T rawTriangle(T x)

Quick and dirty triangle for testing purposes.

sinc
T sinc(T x)

Cardinal sine

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;
Undocumented in source.

Meta

Authors

Guillaume Piolat