Mercurial > hg > match-vamp
changeset 201:2fed1f101172
Another process wrapper
author | Chris Cannam |
---|---|
date | Fri, 27 Feb 2015 10:44:13 +0000 |
parents | f6be68852c1d |
children | b5deca82e074 96dc6a59e1ed |
files | src/FeatureExtractor.cpp src/FeatureExtractor.h |
diffstat | 2 files changed, 28 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/FeatureExtractor.cpp Fri Feb 27 10:05:04 2015 +0000 +++ b/src/FeatureExtractor.cpp Fri Feb 27 10:44:13 2015 +0000 @@ -179,6 +179,18 @@ } feature_t +FeatureExtractor::process(const float *real, const float *imag) +{ + vector<float> mags(m_params.fftSize/2 + 1, 0.0); + + for (int i = 0; i <= m_params.fftSize/2; i++) { + mags[i] = real[i] * real[i] + imag[i] * imag[i]; + } + + return processMags(mags); +} + +feature_t FeatureExtractor::process(const float *cframe) { vector<float> mags(m_params.fftSize/2 + 1, 0.0);
--- a/src/FeatureExtractor.h Fri Feb 27 10:05:04 2015 +0000 +++ b/src/FeatureExtractor.h Fri Feb 27 10:44:13 2015 +0000 @@ -97,8 +97,8 @@ static int getFeatureSizeFor(Parameters params); /** - * Process one frequency-domain audio frame (provided as real & - * imaginary components from the FFT output). Return a feature + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature * vector of size given by getFeatureSize(). Input vectors must * have at least params.fftSize/2+1 elements each. * @@ -110,8 +110,8 @@ const std::vector<double> &imag); /** - * Process one frequency-domain audio frame (provided as real & - * imaginary components from the FFT output). Return a feature + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature * vector of size given by getFeatureSize(). Input vectors must * have at least params.fftSize/2+1 elements each. * @@ -123,6 +123,18 @@ const std::vector<float> &imag); /** + * Process one frequency-domain audio frame, provided as real & + * imaginary components from the FFT output. Return a feature + * vector of size given by getFeatureSize(). Input arrays must + * have at least params.fftSize/2+1 elements each. + * + * Operates by mapping the frequency bins into a part-linear + * part-logarithmic array, unless useChromaFrequencyMap is true in + * which case they are mapped into chroma bins. + */ + feature_t process(const float *real, const float *imag); + + /** * Process one frequency-domain audio frame, provided as a single * array of alternating real and imaginary components. Input array * must have at least 2 * (params.fftSize/2 + 1) elements.