/Users/richardeakin/projects/libsms/trunk/src/analysis.c File Reference

main sms analysis routines More...

#include "sms.h"
Include dependency graph for analysis.c:

Defines

#define SMS_MAX_SPEC   8192
 maximum size for magnitude spectrum

Functions

void sms_analyzeFrame (int iCurrentFrame, SMS_AnalParams *pAnalParams, sfloat fRefFundamental)
 compute spectrum, find peaks, and fundamental of one frame
static int ReAnalyzeFrame (int iCurrentFrame, SMS_AnalParams *pAnalParams)
 re-analyze the previous frames if necessary
int sms_analyze (int sizeWaveform, sfloat *pWaveform, SMS_Data *pSmsData, SMS_AnalParams *pAnalParams)
 main function to perform the SMS analysis on a single frame

Detailed Description

main sms analysis routines

the analysis routine here calls all necessary functions to perform the complete SMS analysis, once the desired analysis parameters are set in SMS_AnalParams.


Define Documentation

#define SMS_MAX_SPEC   8192

maximum size for magnitude spectrum

Referenced by sms_analyzeFrame().


Function Documentation

static int ReAnalyzeFrame ( int  iCurrentFrame,
SMS_AnalParams pAnalParams 
) [static]

re-analyze the previous frames if necessary

Todo:
explain when this is necessary
Parameters:
iCurrentFrame current frame number
pAnalParams structure with analysis parameters
Returns:
1 if frames are good, -1 if analysis is necessary
Todo:
is the return value info correct? Why isn't it used in sms_analyze?

Todo:
mae this a < 0 check, but first make sure sms_fundDeviation does not return values below zero

References SMS_AnalFrame::fFundamental, SMS_AnalParams::fSizeWindow, SMS_AnalFrame::iFrameNum, SMS_AnalFrame::iFrameSize, SMS_AnalParams::iSamplingRate, SMS_AnalFrame::iStatus, SMS_AnalParams::ppFrames, sfloat, SMS_ANAL_DELAY, sms_analyzeFrame(), SMS_FRAME_READY, SMS_FRAME_RECOMPUTED, sms_fundDeviation(), SMS_MAX_DEVIATION, and SMS_MIN_GOOD_FRAMES.

Referenced by sms_analyze().

Here is the call graph for this function:

int sms_analyze ( int  sizeWaveform,
sfloat *  pWaveform,
SMS_Data pSmsData,
SMS_AnalParams pAnalParams 
)

main function to perform the SMS analysis on a single frame

The input is a section of the sound, the output is the SMS data

Parameters:
sizeWaveform size of input waveform data
pWaveform pointer to input waveform data
pSmsData pointer to output SMS data
pAnalParams pointer to analysis parameters
Returns:
Todo:
sort out return meanings

Todo:
when deviation is really off, this function returns -1, yet it isn't used.. is it being recomputed ??

References SMS_AnalFrame::deterministic, SMS_AnalParams::fDefaultFundamental, SMS_AnalFrame::fFundamental, SMS_AnalParams::fResidualAccumPerc, SMS_AnalParams::iCleanTracks, SMS_AnalParams::iDefaultSizeWindow, SMS_AnalParams::iFormat, SMS_AnalFrame::iFrameSample, SMS_SndBuffer::iMarker, SMS_AnalParams::iMaxDelayFrames, SMS_AnalParams::iSamplingRate, SMS_AnalParams::iSoundType, SMS_AnalFrame::iStatus, SMS_AnalParams::iStochasticType, SMS_SEnvParams::iType, MAX, MIN, SMS_AnalFrame::nPeaks, SMS_Data::nTracks, SMS_SndBuffer::pFBuffer, SMS_Data::pFSinAmp, SMS_Data::pFSinFreq, SMS_Data::pFSinPha, SMS_Data::pFStocCoeff, SMS_AnalParams::ppFrames, SMS_Data::pResPhase, SMS_AnalParams::prevFrame, ReAnalyzeFrame(), sfloat, SMS_SndBuffer::sizeBuffer, SMS_AnalParams::sizeHop, SMS_AnalParams::sizeNextRead, sms_analyzeFrame(), sms_arrayDBToMag(), sms_cleanTracks(), sms_clearFrame(), SMS_DELAY_FRAMES, SMS_ENV_NONE, sms_error(), sms_errorCheck(), sms_errorString(), sms_fillSoundBuffer(), sms_filterHighPass(), SMS_FORMAT_HP, SMS_FORMAT_IH, SMS_FORMAT_IHP, SMS_FRAME_DONE, SMS_FRAME_EMPTY, SMS_FRAME_END, SMS_FRAME_READY, sms_fundDeviation(), sms_getWindow(), sms_initFrame(), SMS_MAX_DEVIATION, sms_peakContinuation(), sms_power2(), sms_residual(), sms_scaleDet(), sms_scaleWindow(), sms_sineSynthFrame(), sms_sizeNextWindow(), SMS_SOUND_TYPE_NOTE, sms_spectralEnvelope(), sms_spectrum(), SMS_STOC_APPROX, SMS_STOC_IFFT, SMS_STOC_NONE, sms_stocAnalysis(), SMS_WIN_HAMMING, SMS_AnalParams::soundBuffer, SMS_AnalParams::specEnvParams, and SMS_AnalParams::synthBuffer.

Here is the call graph for this function:

void sms_analyzeFrame ( int  iCurrentFrame,
SMS_AnalParams pAnalParams,
sfloat  fRefFundamental 
)

compute spectrum, find peaks, and fundamental of one frame

This is the main core of analysis calls

Parameters:
iCurrentFrame frame number to be computed
pAnalParams structure of analysis parameters
fRefFundamental reference fundamental

References SMS_AnalParams::iFormat, SMS_AnalFrame::iFrameSample, SMS_AnalFrame::iFrameSize, SMS_SndBuffer::iMarker, SMS_AnalParams::iWindowType, SMS_AnalFrame::nPeaks, SMS_AnalParams::peakParams, SMS_SndBuffer::pFBuffer, SMS_AnalParams::ppFrames, SMS_AnalFrame::pSpectralPeaks, sfloat, sms_arrayMagToDB(), sms_detectPeaks(), SMS_FORMAT_H, SMS_FORMAT_HP, sms_getWindow(), sms_harmDetection(), SMS_MAX_SPEC, sms_power2(), sms_scaleWindow(), sms_spectrum(), and SMS_AnalParams::soundBuffer.

Referenced by ReAnalyzeFrame(), and sms_analyze().

Here is the call graph for this function:

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Thu Oct 29 04:08:06 2009 for libsms by  doxygen 1.6.1