peak detection algorithm and functions More...
#include "sms.h"
Functions | |
| static sfloat | PeakInterpolation (sfloat fMaxVal, sfloat fLeftBinVal, sfloat fRightBinVal, sfloat *pFDiffFromMax) |
| function used for the parabolic interpolation of the spectral peaks | |
| static int | FindNextMax (sfloat *pFMagSpectrum, int iHighBinBound, int *pICurrentLoc, sfloat *pFMaxVal, sfloat fMinPeakMag) |
| detect the next local maximum in the spectrum | |
| static int | FindNextPeak (sfloat *pFMagSpectrum, int iHighestBin, int *pICurrentLoc, sfloat *pFPeakMag, sfloat *pFPeakLoc, sfloat fMinPeakMag) |
| function to detect the next spectral peak | |
| static sfloat | GetPhaseVal (sfloat *pPhaseSpectrum, sfloat fPeakLoc) |
| get the corresponding phase value for a given peak | |
| int | sms_detectPeaks (int sizeSpec, sfloat *pMag, sfloat *pPhase, SMS_Peak *pSpectralPeaks, SMS_PeakParams *pPeakParams) |
| find the prominent spectral peaks | |
peak detection algorithm and functions
| static int FindNextMax | ( | sfloat * | pFMagSpectrum, | |
| int | iHighBinBound, | |||
| int * | pICurrentLoc, | |||
| sfloat * | pFMaxVal, | |||
| sfloat | fMinPeakMag | |||
| ) | [static] |
detect the next local maximum in the spectrum
stores the value in pFMaxVal
| pFMagSpectrum | magnitude spectrum | |
| iHighBinBound | highest bin to search | |
| pICurrentLoc | current bin location | |
| pFMaxVal | value of the maximum found | |
| fMinPeakMag | minimum magnitude to accept a peak |
References sfloat.
Referenced by FindNextPeak().
| static int FindNextPeak | ( | sfloat * | pFMagSpectrum, | |
| int | iHighestBin, | |||
| int * | pICurrentLoc, | |||
| sfloat * | pFPeakMag, | |||
| sfloat * | pFPeakLoc, | |||
| sfloat | fMinPeakMag | |||
| ) | [static] |
function to detect the next spectral peak
| pFMagSpectrum | magnitude spectrum | |
| iHighestBin | highest bin to search | |
| pICurrentLoc | current bin location | |
| pFPeakMag | magnitude value of peak | |
| pFPeakLoc | location of peak | |
| fMinPeakMag | minimum magnitude to accept a peak |
References FindNextMax(), PeakInterpolation(), and sfloat.
Referenced by sms_detectPeaks().

| static sfloat GetPhaseVal | ( | sfloat * | pPhaseSpectrum, | |
| sfloat | fPeakLoc | |||
| ) | [static] |
get the corresponding phase value for a given peak
performs linear interpolation for a more accurate phase
| pPhaseSpectrum | phase spectrum | |
| fPeakLoc | location of peak |
References PI, sfloat, and TWO_PI.
Referenced by sms_detectPeaks().
| static sfloat PeakInterpolation | ( | sfloat | fMaxVal, | |
| sfloat | fLeftBinVal, | |||
| sfloat | fRightBinVal, | |||
| sfloat * | pFDiffFromMax | |||
| ) | [static] |
function used for the parabolic interpolation of the spectral peaks
it performs the interpolation in a log scale and stores the location in pFDiffFromMax and
| fMaxVal | value of max bin | |
| fLeftBinVal | value for left bin | |
| fRightBinVal | value for right bin | |
| pFDiffFromMax | location of the tip as the difference from the top bin |
Referenced by FindNextPeak().
| int sms_detectPeaks | ( | int | sizeSpec, | |
| sfloat * | pMag, | |||
| sfloat * | pPhase, | |||
| SMS_Peak * | pSpectralPeaks, | |||
| SMS_PeakParams * | pPeakParams | |||
| ) |
find the prominent spectral peaks
uses a dB spectrum
| sizeSpec | size of magnitude spectrum | |
| pMag | pointer to power spectrum | |
| pPhase | pointer to phase spectrum | |
| pSpectralPeaks | pointer to array of peaks | |
| pPeakParams | peak detection parameters |
References SMS_Peak::fFreq, SMS_PeakParams::fHighestFreq, FindNextPeak(), SMS_PeakParams::fLowestFreq, SMS_Peak::fMag, SMS_PeakParams::fMinPeakMag, SMS_Peak::fPhase, GetPhaseVal(), SMS_PeakParams::iMaxPeaks, SMS_PeakParams::iSamplingRate, MAX, MIN, and sfloat.
Referenced by sms_analyzeFrame().

1.6.1