Essentia  2.1-beta6-dev
essentiamath.h File Reference
#include <math.h>
#include <cmath>
#include <vector>
#include <numeric>
#include <limits>
#include <functional>
#include <utility>
#include <sstream>
#include <algorithm>
#include <deque>
#include "types.h"
#include "utils/tnt/tnt.h"
#include "utils/tnt/tnt2essentiautils.h"

Go to the source code of this file.

Classes

class  PairCompare< T, U, Comparator >
 

Namespaces

 essentia
 

Macros

#define _USE_MATH_DEFINES
 
#define M_2PI   (2 * M_PI)
 
#define ALL_NOTES   "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"
 
#define SILENCE_CUTOFF   1e-10
 
#define DB_SILENCE_CUTOFF   -100
 
#define LOG_SILENCE_CUTOFF   -23.025850929940457
 

Functions

template<typename T >
bool isPowerTwo (T n)
 
template<typename T >
log2 (T x)
 
template<typename T >
int ilog10 (T n)
 
template<typename T >
nextPowerTwo (T n)
 
template<>
long long int nextPowerTwo (long long int n)
 
template<typename T >
norm (const std::vector< T > &array)
 
template<typename T >
sumSquare (const std::vector< T > array)
 
template<typename T >
sum (const std::vector< T > &array, int start, int end)
 
template<typename T >
mean (const std::vector< T > &array, int start, int end)
 
template<typename T >
sum (const std::vector< T > &array)
 
template<typename T >
mean (const std::vector< T > &array)
 
template<typename T >
TNT::Array2D< T > meanMatrix (const std::vector< TNT::Array2D< T > * > &array)
 
template<typename T >
TNT::Array2D< T > meanMatrix (const std::vector< TNT::Array2D< T > > &array)
 
template<typename T >
std::vector< T > meanFrames (const std::vector< std::vector< T > > &frames, int beginIdx=0, int endIdx=-1)
 
template<typename T >
std::vector< T > medianFrames (const std::vector< std::vector< T > > &frames, int beginIdx=0, int endIdx=-1)
 
template<typename T >
std::vector< T > varianceFrames (const std::vector< std::vector< T > > &frames)
 
template<typename T >
std::vector< T > sumFrames (const std::vector< std::vector< T > > &frames)
 
template<typename T >
std::vector< T > skewnessFrames (const std::vector< std::vector< T > > &frames)
 
template<typename T >
std::vector< T > kurtosisFrames (const std::vector< std::vector< T > > &frames)
 
template<typename T >
median (const std::vector< T > &array)
 
template<typename T >
void rectify (std::vector< T > &array)
 
template<typename T >
energy (const std::vector< T > &array)
 
template<typename T >
instantPower (const std::vector< T > &array)
 
template<typename T >
bool isSilent (const std::vector< T > &array)
 
template<typename T >
TNT::Array2D< T > varianceMatrix (const std::vector< TNT::Array2D< T > > &array, const TNT::Array2D< T > &mean)
 
template<typename T >
TNT::Array2D< T > varianceMatrix (const std::vector< TNT::Array2D< T > * > &array, const TNT::Array2D< T > &mean)
 
template<typename T >
variance (const std::vector< T > &array, const T mean)
 
template<typename T >
skewness (const std::vector< T > &array, const T mean)
 
template<typename T >
kurtosis (const std::vector< T > &array, const T mean)
 
template<typename T >
stddev (const std::vector< T > &array, const T mean)
 
template<typename T >
round (const T value)
 
Real lin2db (Real value)
 
Real lin2db (Real value, Real silenceCutoff, Real dbSilenceCutoff)
 
Real db2lin (Real value)
 
Real pow2db (Real power)
 
Real pow2db (Real power, Real silenceCutoff, Real dbSilenceCutoff)
 
Real db2pow (Real power)
 
Real amp2db (Real amplitude)
 
Real amp2db (Real amplitude, Real silenceCutoff, Real dbSilenceCutoff)
 
Real db2amp (Real amplitude)
 
Real linear (Real input)
 
Real lin2log (Real value)
 
Real lin2log (Real input, Real silenceCutoff, Real logSilenceCutoff)
 
Real hz2bark (Real f)
 
Real bark2hz (Real z)
 
Real barkCriticalBandwidth (Real z)
 
Real mel2hz (Real mel)
 
Real mel102hz (Real mel)
 
Real mel2hzSlaney (Real mel)
 
Real hz2mel (Real hz)
 
Real hz2mel10 (Real hz)
 
Real hz2melSlaney (Real hz)
 
Real hz2hz (Real hz)
 
Real cents2hz (Real cents, Real referenceFrequency)
 
Real hz2cents (Real hz, Real referenceFrequency)
 
int hz2midi (Real hz, Real tuningFrequency)
 
Real midi2hz (int midiNoteNumber, Real tuningFrequency)
 
std::string note2root (std::string note)
 
int note2octave (std::string note)
 
std::string midi2note (int midiNoteNumber)
 
int note2midi (std::string note)
 
std::string hz2note (Real hz, Real tuningFrequency)
 
int note2hz (std::string note, Real tuningFrequency)
 
int db2velocity (Real decibels, Real hearingThreshold)
 
Real velocity2db (int velocity, Real hearingThreshold)
 
int argmin (const std::vector< Real > &input)
 
int argmax (const std::vector< Real > &input)
 
template<typename T >
void normalize (std::vector< T > &array)
 
template<typename T >
void normalizeAbs (std::vector< T > &array)
 
template<typename T >
void normalizeAbs (std::vector< T > &array, T headroom)
 
template<typename T >
void normalizeSum (std::vector< T > &array)
 
template<typename T >
std::vector< T > derivative (const std::vector< T > &array)
 
template<typename T , typename U , typename Comparator >
void sortpair (std::vector< T > &v1, std::vector< U > &v2)
 
bool isDenormal (const float &x)
 
template<typename T >
fmod (T a, T b)
 
template<typename T >
princarg (T y)
 
template<typename T >
void hist (const T *array, uint n, int *n_array, T *x_array, uint n_bins)
 
template<typename T >
void bincount (const std::vector< T > &input, std::vector< T > &output)
 
template<typename T >
std::vector< std::vector< T > > transpose (const std::vector< std::vector< T > > &m)
 
template<typename T >
TNT::Array2D< T > transpose (const TNT::Array2D< T > &m)
 
std::string equivalentKey (const std::string key)
 
template<typename T >
void rotateChroma (std::vector< std::vector< T > > &inputMatrix, int oti)
 
template<typename T >
dotProduct (const std::vector< T > &xArray, const std::vector< T > &yArray)
 
template<typename T >
percentile (const std::vector< T > &array, Real qpercentile)
 
template<typename T >
covariance (const std::vector< T > &x, const T xMean, const std::vector< T > &y, const T yMean)
 
template<typename T >
pearsonCorrelationCoefficient (const std::vector< T > &x, const std::vector< T > &y)
 
template<typename T >
void heavisideStepFunction (std::vector< std::vector< T > > &inputArray)
 
template<typename T >
std::vector< std::vector< T > > pairwiseDistance (const std::vector< std::vector< T > > &m, const std::vector< std::vector< T > > &n)
 
template<typename T >
void tensorGeometricalInfo (const Tensor< T > &tensor, int &axis, std::array< Eigen::Index, 4 - 1 > &squeezeShape, std::array< Eigen::Index, 4 > &summarizerShape, std::array< Eigen::Index, 4 > &broadcastShape)
 
template<typename T >
mean (const Tensor< T > &tensor)
 
template<typename T >
Tensor< T > mean (const Tensor< T > &tensor, int axis)
 
template<typename T >
stddev (const Tensor< T > &tensor, const T mean)
 
template<typename T >
Tensor< T > stddev (const Tensor< T > &tensor, const Tensor< T > mean, int axis)
 
template<typename T >
tensorMin (const Tensor< T > &tensor)
 
template<typename T >
Tensor< T > tensorMin (const Tensor< T > &tensor, int axis)
 
template<typename T >
tensorMax (const Tensor< T > &tensor)
 
template<typename T >
Tensor< T > tensorMax (const Tensor< T > &tensor, int axis)
 
template<typename T >
roundToDecimal (T x, int decimal)
 

Macro Definition Documentation

◆ _USE_MATH_DEFINES

#define _USE_MATH_DEFINES

◆ ALL_NOTES

#define ALL_NOTES   "A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"

◆ DB_SILENCE_CUTOFF

#define DB_SILENCE_CUTOFF   -100

◆ LOG_SILENCE_CUTOFF

#define LOG_SILENCE_CUTOFF   -23.025850929940457

◆ M_2PI

#define M_2PI   (2 * M_PI)

◆ SILENCE_CUTOFF

#define SILENCE_CUTOFF   1e-10