// // Programmer: Craig Stuart Sapp // Creation Date: Mon Jul 2 17:49:01 PDT 2001 // Last Modified: Mon Jul 2 17:49:04 PDT 2001 // Filename: ...sig/maint/code/Filter/Pitch/Pitch.h // Web Address: http://sig.sapp.org/include/sigSignal/Pitch.h // Documentation: http://sig.sapp.org/doc/classes/Pitch // Syntax: C++ // #ifndef _PITCH_H_INCLUDED #define _PITCH_H_INCLUDED #include "Filter.h" #include "CircularBuffer.h" #include "Array.h" typedef Array ArrayDouble; class Pitch : public Filter { public: Pitch (void); ~Pitch (); void action (void); void clear (void); sampleType output (int index); void printState (void); void doHPS (void); void doML (void); protected: int algorithm; // which algorithm to use int mlinit; // boolean for ML initialization sampleType pitch; // stores the pitch analysis sampleType pindex; // stores the pitch analysis sampleType amplitude; // amplitude of the pitch int countdown; // time to the next pitch sampleType inputValue; // inserting analysis buffer int currentFrame; // the subframe being filled int subframecount; // the number of subframes int subframesize; // the size of the subframe int framesize; // size of analysis window int zeroPad; // zeroPad factor int harmonics; // number of harmonics int overlap; // inverse overlapping fraction. Array subframes; // for overlap control CircularBuffer framebuffer; // for overlap control Array signalbuffer; Array spectrumbuffer; Array window; Array mlrefmatrix; Array tspectrum; // extra space for ML algorithm private: void buildAnalysisFrame(void); void generatePitchAnalysis(void); public: static int HPS (double* paddedFrame, int size, int minIndex, int maxIndex, int harmonics, double* spectrum); static int ML (double* paddedFrame, int size, int minIndex, int maxIndex, double* spectrum, double* tspectrum, double** refmatrix, int csize); static void absfft(double* spectrum, double* signal, int size); private: // ML helper functions: void setupML (void); void createMLRefMatrix (double** matrix, int rows, int columns, double minFreq, double step, int harmonics, double srate); void generateMLSignal (double* signal, int size, int harmonics, double freq, double srate); }; #endif /* _PITCH_H_INCLUDED */ // md5sum: 740456c21615a5e7d0a91282ed0bd251 Pitch.h [20050403]