#include <PeakInterpolation.h>
Public Member Functions | |
PeakInterpolation () | |
~PeakInterpolation () | |
void | process (const MatrixXR &frames, const MatrixXR &peakPositions, const MatrixXR &peakMagnitudes, MatrixXR *peakPositionsInterpolated, MatrixXR *peakMagnitudesInterpolated) |
This class represents an object to interpolate peaks in a vector of Real values. The algorithm interpolates the positions and magnitudes of a set of peaks, given the original frame, peak positions and peak magnidutes.
The interpolation consists in fitting a parabola (quadratic interpolation) on the point of the peak and the two points surrounding it.
Note that the interpolation is performed in the decibel domain, and in order to avoid innecessary transformations the resulting interpolated peak magnitudes are returned in decibels.
Constructs a peak interpolation object.
~PeakInterpolation | ( | ) |
Destroys the algorithm and frees its resources.
void process | ( | const MatrixXR & | frames, | |
const MatrixXR & | peakPositions, | |||
const MatrixXR & | peakMagnitudes, | |||
MatrixXR * | peakPositionsInterpolated, | |||
MatrixXR * | peakMagnitudesInterpolated | |||
) |
Interpolates the peaks on each of the rows of frames, peakPositions and peakMagnitudes to put the resulting peak interpolated positions and magnitudes in the rows of peakPositions and peakMagnitudes respectively.
frames | matrix of Real values. | |
peakPositions | matrix of Real values (but always Integers) for the peak indices. The matrix must have the same number of rows as frames and the same number of columns as peakMagnitudes. | |
peakMagnitudes | pointer to a matrix of Real values (but always Integers) for the peak indices. The matrix must have the same number of rows as frames and the same number of columns as peakPositions. | |
peakPositionsInterpolated | pointer to a matrix of Real values for the peak magnitudes. The matrix should have the same number of rows and columns as peakPositions and peakMagnitudes. | |
peakMagnitudesInterpolated | pointer to a matrix of Real values for the peak magnitudes. The matrix should have the same number of rows and columns as peakPositions and peakMagnitudes. Note that the units of this matrix are decibels. |
Note that if the output matrices are not of the required size they will be resized, reallocating a new memory space if necessary.
Referenced by PitchACF::process().