ddsp.util.functions

Copyright 2017 Cut Through Recordings

Members

Functions

decibelToFloat
T decibelToFloat(T value)

Accepts a decibel value and returns its floating point equivalent.

floatToDecibel
T floatToDecibel(T value)

This is a collection of useful DSP related functions and algorithms. if you feel anything is missing, please feel free to add it. Accepts a floating point value and returns its decibel equivalent. value should be in the range of -1 to 1 and returns a float in the range -96 to 0

lagrpol
T lagrpol(T[] arrX, T[] arrY, int order, T input)

Lagrange Interpolation Accepts: arrX = an array of x coordinates. arrY = an array of y coordinates. order = the number of coordinates (size of arrX & arrY) input = the x coordinate whose corresponding y value will be found Returns a y value along the curve that touches each (x,y) pair from arrX and arrY. The pair (input, sum) is a point on that curve.

linearInterp
T linearInterp(T x1, T x2, T y1, T y2, T x)

Linear Interpolation between two points. (x1,y1) is the leftmost point and (x2,y2) is the rightmost point. x is some number between x1 and x2. Returns the corresopnding y value for x such that (x,y) is a point on the line that intersects (x1,y1) and (x2,y2)

msToSamples
T msToSamples(T ms, T sampleRate)

Accepts a time in milliseconds and the sample rate Returns the amount of samples that corresponds to the time in milliseconds.

roundToInt
deprecated int roundToInt(float x)

Simple nothrow @nogc method of rounding a float to an int

samplesToMs
T samplesToMs(T samples, T sampleRate)

Accepts a number of samples and the sample rate. Returns the corresponding time in milliseconds.

sinc
T sinc(T x)

sinc(x) aka the sampling function.

Meta

License

MIT License Author(s): Ethan Reker