Essentia  2.1-beta6-dev
essentia Namespace Reference

Namespaces

 scheduler
 
 standard
 
 streaming
 
 util
 

Classes

class  AlgorithmInfo
 
class  EssentiaFactory
 
class  Configurable
 
class  Logger
 
class  TypeMap
 
class  PairCompare
 
class  Parameter
 
class  ParameterMap
 
class  Pool
 
class  Range
 
class  Everything
 
class  Interval
 
class  Set
 
class  RogueVector
 
class  Stringifier
 
class  Mutex
 
class  MutexLocker
 
class  ForcedMutex
 
class  ForcedMutexLocker
 
class  EssentiaException
 
struct  case_insensitive_str_cmp
 
class  OrderedMap
 
class  EssentiaMap
 
class  TypeProxy
 
class  Tuple2
 
class  Position
 
class  AsciiCanvas
 
class  AsciiBox
 
class  AsciiDAGParser
 
class  AudioContext
 
class  JsonConvert
 
class  JsonException
 
class  YamlException
 
class  YamlNode
 
class  YamlScalarNode
 
class  YamlSequenceNode
 
class  YamlMappingNode
 

Typedefs

typedef int DebuggingSchedule[][3]
 
typedef std::vector< std::pair< std::pair< int, int >, int > > DebuggingScheduleVector
 
typedef std::string DescriptorName
 
typedef float Real
 
typedef EssentiaMap< std::string, std::string, string_cmp > DescriptionMap
 
typedef int ReaderID
 
typedef Real AudioSample
 
typedef Tuple2< RealStereoSample
 
template<typename T >
using Tensor = Eigen::Tensor< T, 4, Eigen::RowMajor >
 
template<typename T >
using TensorMap = Eigen::TensorMap< Tensor< T >, 0 >
 
using TensorScalar = Eigen::Tensor< Real, 0, Eigen::RowMajor >
 
using Tensor1D = Eigen::Tensor< Real, 1, Eigen::RowMajor >
 
using Tensor2D = Eigen::Tensor< Real, 2, Eigen::RowMajor >
 
using Tensor3D = Eigen::Tensor< Real, 3, Eigen::RowMajor >
 
typedef Position Direction
 

Enumerations

enum  DebuggingModule {
  EAlgorithm = 1 << 0 , EConnectors = 1 << 1 , EFactory = 1 << 2 , ENetwork = 1 << 3 ,
  EGraph = 1 << 4 , EExecution = 1 << 5 , EMemory = 1 << 6 , EScheduler = 1 << 7 ,
  EPython = 1 << 20 , EPyBindings = 1 << 21 , EUnittest = 1 << 22 , EUser1 = 1 << 25 ,
  EUser2 = 1 << 26 , ENone = 0 , EAll = (1 << 30) - 1
}
 

Functions

template<typename T >
bool compareByName (const T *a, const T *b)
 
const char * debugModuleDescription (DebuggingModule module)
 
void setDebugLevel (int levels)
 
void unsetDebugLevel (int levels)
 
void saveDebugLevels ()
 
void restoreDebugLevels ()
 
void scheduleDebug (DebuggingSchedule schedule, int nentries)
 
void scheduleDebug (const DebuggingScheduleVector &schedule)
 
void setDebugLevelForTimeIndex (int index)
 
void init ()
 
bool isInitialized ()
 
void shutdown ()
 
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 hz2cents (Real hz)
 
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)
 
template<typename T , typename Array >
std::vector< T > arrayToVector (const Array &array)
 
template<typename T >
int indexOf (const std::vector< T > &v, const T &elem)
 
template<typename T >
bool contains (const std::vector< T > &v, const T &elem)
 
bool contains (const std::vector< std::string > &v, const char *str)
 
template<typename T , typename U >
bool contains (const std::map< T, U > &m, const T &key)
 
template<typename T >
bool contains (const OrderedMap< T > &m, const std::string &key)
 
template<typename T >
bool contains (const OrderedMap< T > &m, const char *key)
 
template<typename T >
bool isValid (const T &value)
 
template<typename T >
bool isValid (const Tuple2< T > &value)
 
bool isValid (const std::string &s)
 
template<typename T >
bool isValid (const std::vector< T > &v)
 
template<typename T >
bool isValid (const std::vector< std::vector< T > > &mat)
 
template<typename T >
bool isValid (const TNT::Array2D< T > &mat)
 
template<typename T >
bool isValid (const Tensor< T > &tensor)
 
template<typename T >
void fastcopy (T *dest, const T *src, int n)
 
template<>
void fastcopy< Real > (Real *dest, const Real *src, int n)
 
template<>
void fastcopy< StereoSample > (StereoSample *dest, const StereoSample *src, int n)
 
template<>
void fastcopy< int > (int *dest, const int *src, int n)
 
void fastcopy (std::vector< Real >::iterator dest, std::vector< Real >::const_iterator src, int n)
 
void fastcopy (std::vector< StereoSample >::iterator dest, std::vector< StereoSample >::const_iterator src, int n)
 
std::ostream & operator<< (std::ostream &out, const Parameter &p)
 
std::ostream & operator<< (std::ostream &out, const ParameterMap &m)
 
std::ostream & operator<< (std::ostream &out, const Parameter::ParamType &t)
 
template<typename T , typename U >
std::ostream & operator<< (std::ostream &out, const std::pair< T, U > &p)
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const std::vector< T > &v)
 
template<typename T >
std::ostream & operator<< (std::ostream &out, const std::set< T > &v)
 
std::string toLower (const std::string &str)
 
std::string toUpper (const std::string &str)
 
std::vector< std::string > tokenize (const std::string &str, const std::string &delimiters, bool trimEmpty=false)
 
std::string strip (const std::string &str)
 
std::string pad (int n, int size, char paddingChar=' ', bool leftPadded=false)
 
std::string pad (const std::string &str, int size, char paddingChar=' ', bool leftPadded=false)
 
bool case_insensitive_char_cmp (char a, char b)
 
bool sameType (const std::type_info &t1, const std::type_info &t2)
 
std::string nameOfType (const std::type_info &type)
 
std::string nameOfType (const TypeProxy &tproxy)
 
bool sameType (const TypeProxy &lhs, const TypeProxy &rhs)
 
std::ostream & operator<< (std::ostream &out, const Position &pos)
 
std::vector< std::string > makeRectangle (const std::string &network)
 
std::vector< std::string > makeRectangle (const char *const *network, int size)
 
std::ostream & operator<< (std::ostream &out, const AsciiCanvas &canvas)
 
bool isBigEndian ()
 
template<typename T >
void removeEndianness (T &x)
 
template<typename T >
void bewrite (std::ofstream &out, const T &value)
 
template<>
void bewrite (std::ofstream &out, const std::string &str)
 
template<>
void bewrite (std::ofstream &out, const std::vector< std::string > &v)
 
template<typename T >
void beread (std::ifstream &in, T &value)
 
template<>
void beread (std::ifstream &in, std::string &str)
 
template<>
void beread (std::ifstream &in, std::vector< std::string > &v)
 
Real lagToBpm (Real lag, Real sampleRate, Real hopSize)
 
Real bpmToLag (Real bpm, Real sampleRate, Real hopSize)
 
int longestChain (const std::vector< Real > &dticks, int startpos, Real period, Real tolerance)
 
void bpmDistance (Real x, Real y, Real &error, Real &ratio)
 
bool areEqual (Real a, Real b, Real tolerance)
 
bool areHarmonics (Real x, Real y, Real epsilon, bool bPower2)
 
Real greatestCommonDivisor (Real x, Real y, Real epsilon)
 
std::vector< RealroundBpms (const std::vector< Real > &bpms)
 
std::vector< RealpostProcessTicks (const std::vector< Real > &origticks)
 
std::vector< RealpostProcessTicks (const std::vector< Real > &origticks, const std::vector< Real > &ticksAmplitudes, const Real &preferredPeriod)
 
void pcmMetadata (const std::string &filename, int &sr, int &ch, int &bitrate)
 
void outputYAMLArray (std::ostream &out, const std::vector< Real > &v)
 
void outputYAMLMatrix (std::ostream &out, const std::vector< std::vector< Real > > &v)
 
void scaleAudioVector (std::vector< Real > &buffer, const Real scale)
 
void cleaningSineTracks (std::vector< std::vector< Real > > &freqsTotal, const int minFrames)
 
void genSpecSines (std::vector< Real > iploc, std::vector< Real > ipmag, std::vector< Real > ipphase, std::vector< std::complex< Real > > &outfft, const int fftSize)
 
void initializeFFT (std::vector< std::complex< Real > > &fft, int sizeFFT)
 
template<typename T >
TNT::Array2D< T > & operator/= (TNT::Array2D< T > &A, const T &k)
 
template<typename T >
TNT::Array2D< T > operator/ (const TNT::Array2D< T > &A, const T &k)
 
template<typename T >
TNT::Array2D< T > & matinit (TNT::Array2D< T > &A)
 
TNT::Array2D< RealvecvecToArray2D (const std::vector< std::vector< Real > > &v)
 
std::vector< std::vector< Real > > array2DToVecvec (const TNT::Array2D< Real > &v2D)
 
YamlNodeparseYaml (FILE *, const std::string &fileString=std::string())
 

Variables

int activatedDebugLevels
 
bool infoLevelActive
 
bool warningLevelActive
 
bool errorLevelActive
 
int debugIndentLevel
 
Logger loggerInstance
 
const char * version
 
const char * version_git_sha
 

Typedef Documentation

◆ AudioSample

typedef Real AudioSample

Type used to represent a mono audio sample.

◆ DebuggingSchedule

typedef int DebuggingSchedule[][3]

◆ DebuggingScheduleVector

typedef std::vector<std::pair<std::pair<int, int>, int> > DebuggingScheduleVector

◆ DescriptionMap

typedef EssentiaMap<std::string, std::string, string_cmp> DescriptionMap

Type of map used for storing the description of the various fields.

◆ DescriptorName

typedef std::string DescriptorName

◆ Direction

Represents a direction when moving in an integer 2D plane

◆ ReaderID

typedef int ReaderID

typedef used for identifying sinks for a given source.

◆ Real

typedef float Real

The main typedef for real numbers.

◆ StereoSample

Type used to represent a stereo sample.

◆ Tensor

using Tensor = Eigen::Tensor<T, 4 , Eigen::RowMajor>

Alias for Eigen::Tensor. Store data in a rowMajor fashion to fit Tensorflow's behavior. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/framework/tensor_types.h

◆ Tensor1D

using Tensor1D = Eigen::Tensor<Real, 1, Eigen::RowMajor>

Alias for a 1-dimensional Eigen::Tensor.

◆ Tensor2D

using Tensor2D = Eigen::Tensor<Real, 2, Eigen::RowMajor>

Alias for a 2-dimensional Eigen::Tensor.

◆ Tensor3D

using Tensor3D = Eigen::Tensor<Real, 3, Eigen::RowMajor>

Alias for a 3-dimensional Eigen::Tensor.

◆ TensorMap

using TensorMap = Eigen::TensorMap<Tensor<T>, 0>

Alias for Eigen::TensorMap.

◆ TensorScalar

using TensorScalar = Eigen::Tensor<Real, 0, Eigen::RowMajor>

Alias for a 0-dimensional Eigen::Tensor.

Enumeration Type Documentation

◆ DebuggingModule

Enumerator
EAlgorithm 
EConnectors 
EFactory 
ENetwork 
EGraph 
EExecution 
EMemory 
EScheduler 
EPython 
EPyBindings 
EUnittest 
EUser1 
EUser2 
ENone 
EAll 

Function Documentation

◆ amp2db() [1/2]

Real essentia::amp2db ( Real  amplitude)
inline

References lin2db().

◆ amp2db() [2/2]

Real essentia::amp2db ( Real  amplitude,
Real  silenceCutoff,
Real  dbSilenceCutoff 
)
inline

References lin2db().

◆ areEqual()

bool essentia::areEqual ( Real  a,
Real  b,
Real  tolerance 
)
inline

References bpmDistance().

◆ areHarmonics()

bool essentia::areHarmonics ( Real  x,
Real  y,
Real  epsilon,
bool  bPower2 
)
inline

References bpmDistance(), and isPowerTwo().

◆ argmax()

int essentia::argmax ( const std::vector< Real > &  input)
inline

Referenced by bincount(), and postProcessTicks().

◆ argmin()

int essentia::argmin ( const std::vector< Real > &  input)
inline

◆ array2DToVecvec()

std::vector<std::vector<Real> > essentia::array2DToVecvec ( const TNT::Array2D< Real > &  v2D)
inline

◆ arrayToVector()

std::vector<T> essentia::arrayToVector ( const Array &  array)

Utility function that converts a C-style array into a C++ std::vector.

References ARRAY_SIZE.

◆ bark2hz()

Real essentia::bark2hz ( Real  z)
inline

Converts a Bark value into its corresponding frequency. This formula is deduced from: H. Traunmüller (1990) "Analytical expressions for the tonotopic sensory scale" J. Acoust. Soc. Am. 88: 97-100. and has been independently verified to be the one that best matches the band frequencies defined by Zwicker in 1961.

Parameters
zthe critical band rate, in Bark

◆ barkCriticalBandwidth()

Real essentia::barkCriticalBandwidth ( Real  z)
inline

◆ beread() [1/3]

void essentia::beread ( std::ifstream &  in,
std::string &  str 
)

References beread().

◆ beread() [2/3]

void essentia::beread ( std::ifstream &  in,
std::vector< std::string > &  v 
)

References beread().

◆ beread() [3/3]

void essentia::beread ( std::ifstream &  in,
T &  value 
)

References removeEndianness().

Referenced by beread().

◆ bewrite() [1/3]

void essentia::bewrite ( std::ofstream &  out,
const std::string &  str 
)

References bewrite().

◆ bewrite() [2/3]

void essentia::bewrite ( std::ofstream &  out,
const std::vector< std::string > &  v 
)

References bewrite().

◆ bewrite() [3/3]

void essentia::bewrite ( std::ofstream &  out,
const T &  value 
)

References removeEndianness().

Referenced by bewrite().

◆ bincount()

void essentia::bincount ( const std::vector< T > &  input,
std::vector< T > &  output 
)

returns in output the number of occurence of each value in the input vector

References argmax().

◆ bpmDistance()

void essentia::bpmDistance ( Real  x,
Real  y,
Real error,
Real ratio 
)
inline

References round().

Referenced by areEqual(), areHarmonics(), and greatestCommonDivisor().

◆ bpmToLag()

Real essentia::bpmToLag ( Real  bpm,
Real  sampleRate,
Real  hopSize 
)
inline

References lagToBpm().

◆ case_insensitive_char_cmp()

bool essentia::case_insensitive_char_cmp ( char  a,
char  b 
)
inline

Case-insensitive compare function for characters.

Referenced by case_insensitive_str_cmp::operator()().

◆ cleaningSineTracks()

void essentia::cleaningSineTracks ( std::vector< std::vector< Real > > &  freqsTotal,
const int  minFrames 
)

◆ compareByName()

bool essentia::compareByName ( const T *  a,
const T *  b 
)

◆ contains() [1/5]

bool essentia::contains ( const OrderedMap< T > &  m,
const char *  key 
)

References contains().

◆ contains() [2/5]

bool essentia::contains ( const OrderedMap< T > &  m,
const std::string &  key 
)

◆ contains() [3/5]

bool essentia::contains ( const std::map< T, U > &  m,
const T &  key 
)

Utility function to test whether a key is in a map.

◆ contains() [4/5]

bool essentia::contains ( const std::vector< std::string > &  v,
const char *  str 
)
inline

References contains().

◆ contains() [5/5]

bool essentia::contains ( const std::vector< T > &  v,
const T &  elem 
)

Returns whether a vector of a certain type contains an element or not. Comparison is done using the '==' operator, so you can even use it for your own types if you overload this operator.

References indexOf().

Referenced by NetworkNode::addChild(), and contains().

◆ covariance()

T essentia::covariance ( const std::vector< T > &  x,
const T  xMean,
const std::vector< T > &  y,
const T  yMean 
)

Sample covariance

Referenced by pearsonCorrelationCoefficient().

◆ db2amp()

Real essentia::db2amp ( Real  amplitude)
inline

References db2lin().

◆ db2lin()

Real essentia::db2lin ( Real  value)
inline

Referenced by db2amp(), and db2pow().

◆ db2pow()

Real essentia::db2pow ( Real  power)
inline

References db2lin().

◆ debugModuleDescription()

const char* essentia::debugModuleDescription ( DebuggingModule  module)

◆ derivative()

std::vector<T> essentia::derivative ( const std::vector< T > &  array)

◆ dotProduct()

T essentia::dotProduct ( const std::vector< T > &  xArray,
const std::vector< T > &  yArray 
)

returns the dot product of two 1D vectors. Throws an exception either one of the input arrays are empty.

Referenced by pairwiseDistance().

◆ energy()

T essentia::energy ( const std::vector< T > &  array)

Referenced by instantPower().

◆ equivalentKey()

std::string essentia::equivalentKey ( const std::string  key)
inline

◆ fastcopy() [1/3]

void essentia::fastcopy ( std::vector< Real >::iterator  dest,
std::vector< Real >::const_iterator  src,
int  n 
)
inline

References fastcopy().

◆ fastcopy() [2/3]

void essentia::fastcopy ( std::vector< StereoSample >::iterator  dest,
std::vector< StereoSample >::const_iterator  src,
int  n 
)
inline

References fastcopy().

◆ fastcopy() [3/3]

void essentia::fastcopy ( T *  dest,
const T *  src,
int  n 
)
inline

This function, which has the same interface as memcpy, performs either memcpy (fast) for basic types, or does a simple copy element by element (for strings, for instance).

Referenced by fastcopy(), Copy< TokenType >::process(), VectorInput< TokenType, acquireSize >::process(), VectorOutput< TokenType, StorageType >::process(), and PhantomBuffer< T >::releaseForWrite().

◆ fastcopy< int >()

void essentia::fastcopy< int > ( int *  dest,
const int *  src,
int  n 
)
inline

◆ fastcopy< Real >()

void essentia::fastcopy< Real > ( Real dest,
const Real src,
int  n 
)
inline

◆ fastcopy< StereoSample >()

void essentia::fastcopy< StereoSample > ( StereoSample dest,
const StereoSample src,
int  n 
)
inline

◆ fmod()

T essentia::fmod ( a,
b 
)

Referenced by princarg().

◆ genSpecSines()

void essentia::genSpecSines ( std::vector< Real iploc,
std::vector< Real ipmag,
std::vector< Real ipphase,
std::vector< std::complex< Real > > &  outfft,
const int  fftSize 
)

◆ greatestCommonDivisor()

Real essentia::greatestCommonDivisor ( Real  x,
Real  y,
Real  epsilon 
)
inline

References bpmDistance().

Referenced by roundBpms().

◆ heavisideStepFunction()

void essentia::heavisideStepFunction ( std::vector< std::vector< T > > &  inputArray)

Apply heaviside step function to an input m X n dimentional vector. f(x) = if x<0: x=0; if x>=0: x=1 Throws an exception if the input array is empty. returns a 2D binary vector of m X n shape

◆ hist()

void essentia::hist ( const T *  array,
uint  n,
int *  n_array,
T *  x_array,
uint  n_bins 
)

Given a set of values, computes the associated histogram. This method is designed to work the same way as in Matlab/Octave. It is based on the algorithms used in Octave rather than Matlab. The result structures (n_arr, x_arr) have to be allocated before calling this function.

Parameters
arraythe input array, containing the data values
nthe number of elements of this array
n_arraythe array where the distribution will be written
x_arraythe array that will contain the centers of each bin
n_binsthe number of desired bins for the distribution

Referenced by postProcessTicks().

◆ hz2bark()

Real essentia::hz2bark ( Real  f)
inline

Converts a given frequency into its Bark value. This formula is taken from: H. Traunmüller (1990) "Analytical expressions for the tonotopic sensory scale" J. Acoust. Soc. Am. 88: 97-100. and has been independently verified to be the one that best matches the band frequencies defined by Zwicker in 1961.

Parameters
fthe input frequency, in Hz

◆ hz2cents()

Real essentia::hz2cents ( Real  hz)
inline

◆ hz2hz()

Real essentia::hz2hz ( Real  hz)
inline

◆ hz2mel()

Real essentia::hz2mel ( Real  hz)
inline

◆ hz2mel10()

Real essentia::hz2mel10 ( Real  hz)
inline

◆ hz2melSlaney()

Real essentia::hz2melSlaney ( Real  hz)
inline

◆ ilog10()

int essentia::ilog10 ( n)

◆ indexOf()

int essentia::indexOf ( const std::vector< T > &  v,
const T &  elem 
)

Return the index of the given element inside the vector. If elem was not found in v, return -1.

Referenced by contains().

◆ init()

void essentia::init ( )

This function registers the algorithms in the factory, so that they are ready for use. It also builds a list of available types and their "human-readable" representations. You need to call this function before doing anything with essentia.

◆ initializeFFT()

void essentia::initializeFFT ( std::vector< std::complex< Real > > &  fft,
int  sizeFFT 
)

◆ instantPower()

T essentia::instantPower ( const std::vector< T > &  array)

References energy().

Referenced by isSilent().

◆ isBigEndian()

bool essentia::isBigEndian ( )
inline

Referenced by removeEndianness().

◆ isDenormal()

bool essentia::isDenormal ( const float &  x)
inline

◆ isInitialized()

bool essentia::isInitialized ( )

◆ isPowerTwo()

bool essentia::isPowerTwo ( n)

Referenced by areHarmonics().

◆ isSilent()

bool essentia::isSilent ( const std::vector< T > &  array)

References instantPower(), and SILENCE_CUTOFF.

◆ isValid() [1/7]

bool essentia::isValid ( const std::string &  s)
inline

◆ isValid() [2/7]

bool essentia::isValid ( const std::vector< std::vector< T > > &  mat)
inline

References isValid().

◆ isValid() [3/7]

bool essentia::isValid ( const std::vector< T > &  v)
inline

References isValid().

◆ isValid() [4/7]

bool essentia::isValid ( const T &  value)
inline

Return whether a value is valid or not, ie: is not Inf nor NaN.

Referenced by isValid().

◆ isValid() [5/7]

bool essentia::isValid ( const Tensor< T > &  tensor)
inline

References isValid().

◆ isValid() [6/7]

bool essentia::isValid ( const TNT::Array2D< T > &  mat)
inline

◆ isValid() [7/7]

bool essentia::isValid ( const Tuple2< T > &  value)
inline

◆ kurtosis()

T essentia::kurtosis ( const std::vector< T > &  array,
const T  mean 
)

References mean().

◆ kurtosisFrames()

std::vector<T> essentia::kurtosisFrames ( const std::vector< std::vector< T > > &  frames)

References meanFrames().

◆ lagToBpm()

Real essentia::lagToBpm ( Real  lag,
Real  sampleRate,
Real  hopSize 
)
inline

Referenced by bpmToLag().

◆ lin2db() [1/2]

Real essentia::lin2db ( Real  value)
inline

References DB_SILENCE_CUTOFF, and SILENCE_CUTOFF.

Referenced by amp2db(), and pow2db().

◆ lin2db() [2/2]

Real essentia::lin2db ( Real  value,
Real  silenceCutoff,
Real  dbSilenceCutoff 
)
inline

◆ lin2log() [1/2]

Real essentia::lin2log ( Real  input,
Real  silenceCutoff,
Real  logSilenceCutoff 
)
inline

◆ lin2log() [2/2]

Real essentia::lin2log ( Real  value)
inline

◆ linear()

Real essentia::linear ( Real  input)
inline

◆ log2()

T essentia::log2 ( x)

◆ longestChain()

int essentia::longestChain ( const std::vector< Real > &  dticks,
int  startpos,
Real  period,
Real  tolerance 
)
inline

Referenced by postProcessTicks().

◆ makeRectangle() [1/2]

std::vector<std::string> essentia::makeRectangle ( const char *const *  network,
int  size 
)

Take an array of C strings representing the network in ASCII art form and turn it into a rectangle, which is a vector of string rows where each row has the same length. This will allow us to navigate in it with rect[x][y], for instance.

◆ makeRectangle() [2/2]

std::vector<std::string> essentia::makeRectangle ( const std::string &  network)

Take a string representing the network in ASCII art form and turn it into a rectangle, which is a vector of string rows where each row has the same length. This will allow us to navigate in it with rect[x][y], for instance.

Referenced by AsciiCanvas::AsciiCanvas().

◆ matinit()

TNT::Array2D<T>& essentia::matinit ( TNT::Array2D< T > &  A)

◆ mean() [1/4]

T essentia::mean ( const std::vector< T > &  array)

returns the mean of an array.

References mean().

◆ mean() [2/4]

T essentia::mean ( const std::vector< T > &  array,
int  start,
int  end 
)

returns the mean of an array, unrolled version.

References sum().

Referenced by kurtosis(), mean(), meanMatrix(), pearsonCorrelationCoefficient(), postProcessTicks(), MTRand::randNorm(), skewness(), stddev(), variance(), and varianceMatrix().

◆ mean() [3/4]

T essentia::mean ( const Tensor< T > &  tensor)

Returns the mean of a tensor.

◆ mean() [4/4]

Tensor<T> essentia::mean ( const Tensor< T > &  tensor,
int  axis 
)

Returns the mean of a tensor along the given axis.

References tensorGeometricalInfo(), and TENSORRANK.

◆ meanFrames()

std::vector<T> essentia::meanFrames ( const std::vector< std::vector< T > > &  frames,
int  beginIdx = 0,
int  endIdx = -1 
)

◆ meanMatrix() [1/2]

TNT::Array2D<T> essentia::meanMatrix ( const std::vector< TNT::Array2D< T > * > &  array)

returns the mean of an array of TNT::Array2D*

References matinit(), and mean().

◆ meanMatrix() [2/2]

TNT::Array2D<T> essentia::meanMatrix ( const std::vector< TNT::Array2D< T > > &  array)

returns the mean of an array of TNT::Array2D

References matinit(), and mean().

◆ median()

T essentia::median ( const std::vector< T > &  array)

◆ medianFrames()

std::vector<T> essentia::medianFrames ( const std::vector< std::vector< T > > &  frames,
int  beginIdx = 0,
int  endIdx = -1 
)

◆ mel102hz()

Real essentia::mel102hz ( Real  mel)
inline

◆ mel2hz()

Real essentia::mel2hz ( Real  mel)
inline

◆ mel2hzSlaney()

Real essentia::mel2hzSlaney ( Real  mel)
inline

◆ nameOfType() [1/2]

std::string essentia::nameOfType ( const std::type_info &  type)

◆ nameOfType() [2/2]

std::string essentia::nameOfType ( const TypeProxy tproxy)
inline

Commodity function to return the name of the type used in a TypeProxy.

References nameOfType(), and TypeProxy::typeInfo().

◆ nextPowerTwo() [1/2]

long long int essentia::nextPowerTwo ( long long int  n)
inline

◆ nextPowerTwo() [2/2]

T essentia::nextPowerTwo ( n)

Return the next power of two after the given number n. If n is already a power of two, return n.

◆ norm()

T essentia::norm ( const std::vector< T > &  array)

Returns the L2-norm of an array

References sum().

Referenced by Eigenvalue< Real >::hqr2().

◆ normalize()

void essentia::normalize ( std::vector< T > &  array)

◆ normalizeAbs() [1/2]

void essentia::normalizeAbs ( std::vector< T > &  array)

References rectify().

◆ normalizeAbs() [2/2]

void essentia::normalizeAbs ( std::vector< T > &  array,
headroom 
)

References rectify().

◆ normalizeSum()

void essentia::normalizeSum ( std::vector< T > &  array)

◆ operator/()

TNT::Array2D<T> essentia::operator/ ( const TNT::Array2D< T > &  A,
const T &  k 
)

◆ operator/=()

TNT::Array2D<T>& essentia::operator/= ( TNT::Array2D< T > &  A,
const T &  k 
)

◆ operator<<() [1/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const AsciiCanvas canvas 
)
inline

◆ operator<<() [2/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const Parameter p 
)

◆ operator<<() [3/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const Parameter::ParamType t 
)

◆ operator<<() [4/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const ParameterMap m 
)

◆ operator<<() [5/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const Position pos 
)
inline

References Position::x, and Position::y.

◆ operator<<() [6/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const std::pair< T, U > &  p 
)

Output a std::complex into an output stream. Output a std::pair into an output stream.

◆ operator<<() [7/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const std::set< T > &  v 
)

Output a std::set into an output stream.

◆ operator<<() [8/8]

std::ostream& essentia::operator<< ( std::ostream &  out,
const std::vector< T > &  v 
)

Output a std::vector into an output stream.

◆ outputYAMLArray()

void essentia::outputYAMLArray ( std::ostream &  out,
const std::vector< Real > &  v 
)

◆ outputYAMLMatrix()

void essentia::outputYAMLMatrix ( std::ostream &  out,
const std::vector< std::vector< Real > > &  v 
)

◆ pad() [1/2]

std::string essentia::pad ( const std::string &  str,
int  size,
char  paddingChar = ' ',
bool  leftPadded = false 
)

◆ pad() [2/2]

std::string essentia::pad ( int  n,
int  size,
char  paddingChar = ' ',
bool  leftPadded = false 
)

◆ pairwiseDistance()

std::vector<std::vector<T> > essentia::pairwiseDistance ( const std::vector< std::vector< T > > &  m,
const std::vector< std::vector< T > > &  n 
)

Pairwise euclidean distances between two 2D vectors. Throws an exception if the input array is empty. Returns a (m.shape[0], n.shape[0]) dimentional vector where m and n are the two input arrays TODO: [add other distance metrics beside euclidean such as cosine, mahanalobis etc as a configurable parameter]

References dotProduct().

◆ parseYaml()

YamlNode* essentia::parseYaml ( FILE *  ,
const std::string &  fileString = std::string() 
)

◆ pcmMetadata()

void essentia::pcmMetadata ( const std::string &  filename,
int &  sr,
int &  ch,
int &  bitrate 
)

◆ pearsonCorrelationCoefficient()

T essentia::pearsonCorrelationCoefficient ( const std::vector< T > &  x,
const std::vector< T > &  y 
)

Returns the sample Pearson correlation coefficient of a pair of vectors as described in, https://en.wikipedia.org/wiki/Pearson_correlation_coefficient

References covariance(), mean(), and stddev().

◆ percentile()

T essentia::percentile ( const std::vector< T > &  array,
Real  qpercentile 
)

returns the q-th percentile of an 1D input array (same as numpy percentile implementation).
Throws an exception if the input array is empty.

◆ postProcessTicks() [1/2]

std::vector<Real> essentia::postProcessTicks ( const std::vector< Real > &  origticks)
inline

References hist(), longestChain(), and mean().

◆ postProcessTicks() [2/2]

std::vector<Real> essentia::postProcessTicks ( const std::vector< Real > &  origticks,
const std::vector< Real > &  ticksAmplitudes,
const Real preferredPeriod 
)
inline

References argmax(), hist(), longestChain(), and mean().

◆ pow2db() [1/2]

Real essentia::pow2db ( Real  power)
inline

References lin2db().

◆ pow2db() [2/2]

Real essentia::pow2db ( Real  power,
Real  silenceCutoff,
Real  dbSilenceCutoff 
)
inline

References lin2db().

◆ princarg()

T essentia::princarg ( y)

References fmod(), and M_2PI.

◆ rectify()

void essentia::rectify ( std::vector< T > &  array)

Referenced by normalizeAbs().

◆ removeEndianness()

void essentia::removeEndianness ( T &  x)

References isBigEndian().

Referenced by beread(), and bewrite().

◆ restoreDebugLevels()

void essentia::restoreDebugLevels ( )

◆ rotateChroma()

void essentia::rotateChroma ( std::vector< std::vector< T > > &  inputMatrix,
int  oti 
)

Circularly rotate an input chromagram by an specified optimal transposition index (oti). Expects input chromagram to be in the shape (frames , n_bins) where frames is no of frames and n_bins is no of chroma bins. Throws an exception if the input chromagram is empty.

◆ round()

T essentia::round ( const T  value)

◆ roundBpms()

std::vector<Real> essentia::roundBpms ( const std::vector< Real > &  bpms)
inline

References greatestCommonDivisor(), and round().

◆ roundToDecimal()

T essentia::roundToDecimal ( x,
int  decimal 
)

Rounds x up to the desired decimal place.

References round().

◆ sameType() [1/2]

bool essentia::sameType ( const std::type_info &  t1,
const std::type_info &  t2 
)
inline

Return true if the two given types are the same.

Referenced by TypeProxy::checkType(), and sameType().

◆ sameType() [2/2]

bool essentia::sameType ( const TypeProxy lhs,
const TypeProxy rhs 
)
inline

Commodity function to compare two TypeProxy using their respective type.

References sameType(), and TypeProxy::typeInfo().

◆ saveDebugLevels()

void essentia::saveDebugLevels ( )

◆ scaleAudioVector()

void essentia::scaleAudioVector ( std::vector< Real > &  buffer,
const Real  scale 
)

◆ scheduleDebug() [1/2]

void essentia::scheduleDebug ( const DebuggingScheduleVector schedule)

◆ scheduleDebug() [2/2]

void essentia::scheduleDebug ( DebuggingSchedule  schedule,
int  nentries 
)

the given schedule variable is a vector of pair of ints representing the range of indices for which to activate the given debugging module.

Example:

DebuggingSchedule s = { {0, INT_MAX, EAlgorithm}, // always active {500, INT_MAX, ENetwork | EMemory}, // from time index 500 until the end {782, 782, EScheduler}; // only for time index 782 scheduleDebug(s, ARRAY_SIZE(s));

◆ setDebugLevel()

void essentia::setDebugLevel ( int  levels)

◆ setDebugLevelForTimeIndex()

void essentia::setDebugLevelForTimeIndex ( int  index)

Set the debugging modules for the given time index as specified by the scheduleDebug() function call.

◆ shutdown()

void essentia::shutdown ( )

◆ skewness()

T essentia::skewness ( const std::vector< T > &  array,
const T  mean 
)

References mean().

◆ skewnessFrames()

std::vector<T> essentia::skewnessFrames ( const std::vector< std::vector< T > > &  frames)

References meanFrames().

◆ sortpair()

void essentia::sortpair ( std::vector< T > &  v1,
std::vector< U > &  v2 
)

◆ stddev() [1/3]

T essentia::stddev ( const std::vector< T > &  array,
const T  mean 
)

References mean(), and variance().

Referenced by pearsonCorrelationCoefficient().

◆ stddev() [2/3]

T essentia::stddev ( const Tensor< T > &  tensor,
const T  mean 
)

Returns the standard deviation of a tensor.

References mean().

◆ stddev() [3/3]

Tensor<T> essentia::stddev ( const Tensor< T > &  tensor,
const Tensor< T >  mean,
int  axis 
)

Returns the standard deviation of a tensor along the given axis.

References mean(), tensorGeometricalInfo(), and TENSORRANK.

◆ strip()

std::string essentia::strip ( const std::string &  str)

Strip the given string of its leading and trailing whitespace characters.

◆ sum() [1/2]

T essentia::sum ( const std::vector< T > &  array)

returns the sum of an array.

References sum().

◆ sum() [2/2]

T essentia::sum ( const std::vector< T > &  array,
int  start,
int  end 
)

returns the sum of an array, unrolled version.

Referenced by TNT::dot_prod(), TNT::matmult(), mean(), norm(), sum(), and sumSquare().

◆ sumFrames()

std::vector<T> essentia::sumFrames ( const std::vector< std::vector< T > > &  frames)

◆ sumSquare()

T essentia::sumSquare ( const std::vector< T >  array)

Returns the sum of squared values of an array

References sum().

◆ tensorGeometricalInfo()

void essentia::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 
)

Sets squeezeShape, summarizerShape, broadcastShape to perform operations on a Tensor with the shape of tensor along the axis dimension.

References TENSORRANK.

Referenced by mean(), stddev(), tensorMax(), and tensorMin().

◆ tensorMax() [1/2]

T essentia::tensorMax ( const Tensor< T > &  tensor)

Returns the maximum of a tensor.

◆ tensorMax() [2/2]

Tensor<T> essentia::tensorMax ( const Tensor< T > &  tensor,
int  axis 
)

Returns the maximum of a tensor along the given axis.

References tensorGeometricalInfo(), and TENSORRANK.

◆ tensorMin() [1/2]

T essentia::tensorMin ( const Tensor< T > &  tensor)

Returns the minimum of a tensor.

◆ tensorMin() [2/2]

Tensor<T> essentia::tensorMin ( const Tensor< T > &  tensor,
int  axis 
)

Returns the minimum of a tensor along the given axis.

References tensorGeometricalInfo(), and TENSORRANK.

◆ tokenize()

std::vector<std::string> essentia::tokenize ( const std::string &  str,
const std::string &  delimiters,
bool  trimEmpty = false 
)

Return a string split whenever there is a char contained in the given delimiters argument.

◆ toLower()

std::string essentia::toLower ( const std::string &  str)

Return a new string with the characters of str in lower-case.

◆ toUpper()

std::string essentia::toUpper ( const std::string &  str)

Return a new string with the characters of str in upper-case.

◆ transpose() [1/2]

std::vector<std::vector<T> > essentia::transpose ( const std::vector< std::vector< T > > &  m)

Transpose the given matrix. This function throws an exception if all the rows do not have the same size.

◆ transpose() [2/2]

TNT::Array2D<T> essentia::transpose ( const TNT::Array2D< T > &  m)

◆ unsetDebugLevel()

void essentia::unsetDebugLevel ( int  levels)

◆ variance()

T essentia::variance ( const std::vector< T > &  array,
const T  mean 
)

References mean().

Referenced by MTRand::randNorm(), stddev(), and varianceMatrix().

◆ varianceFrames()

std::vector<T> essentia::varianceFrames ( const std::vector< std::vector< T > > &  frames)

References meanFrames().

◆ varianceMatrix() [1/2]

TNT::Array2D<T> essentia::varianceMatrix ( const std::vector< TNT::Array2D< T > * > &  array,
const TNT::Array2D< T > &  mean 
)

References matinit(), mean(), and variance().

◆ varianceMatrix() [2/2]

TNT::Array2D<T> essentia::varianceMatrix ( const std::vector< TNT::Array2D< T > > &  array,
const TNT::Array2D< T > &  mean 
)

References matinit(), mean(), and variance().

◆ vecvecToArray2D()

TNT::Array2D<Real> essentia::vecvecToArray2D ( const std::vector< std::vector< Real > > &  v)
inline

Variable Documentation

◆ activatedDebugLevels

int activatedDebugLevels
extern

A bitmask representing which debug levels are currently activated.

◆ debugIndentLevel

int debugIndentLevel
extern

An integer representing the indentation with which to print the debug messages

◆ errorLevelActive

bool errorLevelActive
extern

◆ infoLevelActive

bool infoLevelActive
extern

◆ loggerInstance

Logger loggerInstance
extern

◆ version

const char* version
extern

◆ version_git_sha

const char* version_git_sha
extern

◆ warningLevelActive

bool warningLevelActive
extern