|
marvin 0.0.1
Pure C++ audio helper library
|
Math helper functions and classes. More...
Namespaces | |
| namespace | interpolators |
| namespace | vecops |
| Collection of basic arithmetic operations on vectors, SIMD accelerated where possible. | |
| namespace | windows |
| Various windowing functions. An interactive graph with more intuition than the textual documentation can give can be found here | |
Classes | |
| class | Hadamard |
| A helper class to apply an NxN Hadamard matrix to a given input array-like. More... | |
| class | Householder |
| A helper class to apply an NxN Householder matrix to a given input array-like. More... | |
| class | LeakyIntegrator |
| An integrator of a continuous signal which leaks a small amount of said signal over time. More... | |
| class | Reciprocal |
| Class to handle mapping from one range to another (warped) range, based on the reciprocal function 1/x. More... | |
| struct | ReciprocalRange |
| Convenience POD struct for representing a range used by marvin::math::ReciprocalRange. More... | |
Functions | |
| template<FloatType T> | |
| T | lerp (T start, T end, T ratio) noexcept |
| template<FloatType T> | |
| T | remap (T x, T newMin, T newMax) |
| template<FloatType T> | |
| T | remap (T x, T srcMin, T srcMax, T newMin, T newMax) |
| template<FloatType T> | |
| T | remap (T x, marvin::utils::Range< T > srcRange, marvin::utils::Range< T > newRange) |
| template<FloatType T> | |
| T | remap (T x, marvin::utils::Range< T > newRange) |
| template<FloatType T> | |
| std::span< std::complex< T > > | interleavedToComplexView (std::span< T > data) |
| template<FloatType T> | |
| std::span< T > | complexViewToInterleaved (std::span< std::complex< T > > data) |
| template<FloatType T> | |
| T | sinc (T x) noexcept |
| template<FloatType T> | |
| T | msToSeconds (T ms) noexcept |
| template<FloatType T> | |
| T | secondsToSamples (T seconds, double sampleRate) noexcept |
| template<FloatType T> | |
| T | msToSamples (T ms, double sampleRate) noexcept |
| template<FloatType T> | |
| T | dbToGain (T db, T referenceMinDb=static_cast< T >(-100.0)) |
| template<FloatType T> | |
| T | gainToDb (T gain, T minusInfDb=static_cast< T >(-100.0)) noexcept |
| template<FloatType T> | |
| ReciprocalRange< T > | operator+ (const ReciprocalRange< T > &other, T constant) |
| template<FloatType T> | |
| ReciprocalRange< T > | operator- (const ReciprocalRange< T > &other, T constant) |
| template<FloatType T> | |
| ReciprocalRange< T > | operator* (const ReciprocalRange< T > &other, T constant) |
| template<FloatType T> | |
| ReciprocalRange< T > | operator/ (const ReciprocalRange< T > &other, T constant) |
Math helper functions and classes.
|
nodiscard |
Takes an array-like of std::complex<T>s of size N, and creates a non owning view treating the packed complex data as an interleaved stream of reals, represented as [re, im, re, im... im] of size N*2. Uses terrifying reinterpret-cast shennanigans to do so, and absolutely requires the caller to ensure that data.size() is even.
| data | The data to create the view into. |
|
nodiscard |
Converts from decibels to gain.
| db | The level in decibels. |
| referenceMinDb | The level in decibels that should correspond to 0 gain. Optional, defaults to -100dB. |
|
nodiscardnoexcept |
Converts from gain to decibels.
| gain | The 0 to 1 gain to convert. |
| minusInfDb | The level in decibels that should correspond to 0 gain. Optional, defaults to -100dB. |
|
nodiscard |
Takes an array-like of complexes represented as [re, im, re, im, ... im] of size N and creates a non-owning view treating the interleaved stream as an array-like of type std::complex<T> N/2 points long, with no copies or allocations.
Uses terrifying reinterpret-cast shennanigans to do so, and absolutely requires the caller to ensure that data.size() is even.
| data | The data to create a view into. |
|
nodiscardnoexcept |
Returns a point ratio of the way between start and end.
| start | The start value of the interpolation. |
| end | The end value of the interpolation. |
| ratio | The (0 to 1) position between start and end |
|
nodiscardnoexcept |
Converts a time in milliseconds to samples.
| ms | Time in milliseconds. |
| sampleRate | The currently used sample rate. |
|
nodiscardnoexcept |
Converts a time in milliseconds to seconds
| ms | Time in milliseconds. |
| ReciprocalRange< T > marvin::math::operator* | ( | const ReciprocalRange< T > & | other, |
| T | constant ) |
| ReciprocalRange< T > marvin::math::operator+ | ( | const ReciprocalRange< T > & | other, |
| T | constant ) |
| ReciprocalRange< T > marvin::math::operator- | ( | const ReciprocalRange< T > & | other, |
| T | constant ) |
| ReciprocalRange< T > marvin::math::operator/ | ( | const ReciprocalRange< T > & | other, |
| T | constant ) |
|
nodiscard |
Takes a value in range 0 to 1, and rescales it to be in range newRange.
| x | The value to remap. |
| newRange | The range to map the value into. |
|
nodiscard |
Takes a value in range srcRange, normalises it, and remaps it to be in range newRange.
| x | The value to remap. |
| srcRange | The range the value is currently in. |
| newRange | The range to map the value into. |
|
nodiscard |
Takes a value in range 0 to 1, and rescales it to be in range newMin to newMax.
| x | The value to remap. |
| newMin | The new range's min. |
| newMax | The new range's max. |
|
nodiscard |
Takes a value in range srcMin to srcMax, normalises it, and rescales it to be in range newMin to newMax
| x | The value to remap. |
| srcMin | The min of the value's original range. |
| srcMax | The max of the value's original range. |
| newMin | The new range's min. |
| newMax | The new range's max. |
|
nodiscardnoexcept |
Converts a time in seconds to samples.
| seconds | Time in seconds. |
| sampleRate | The currently used sample rate. |
|
nodiscardnoexcept |