comparison src/OnsetDetectionFunction.h @ 66:b387d8327729

Overloaded initialise in OnsetDetectionFunction so the hopSize and frameSize can be set independently of the window type and onset detection function type
author Adam Stark <adamstark@users.noreply.github.com>
date Tue, 28 Jan 2014 00:49:53 +0000
parents d3c52c6b3905
children f6708e4c69f1
comparison
equal deleted inserted replaced
65:105999275c2e 66:b387d8327729
56 /** A class for calculating onset detection functions. */ 56 /** A class for calculating onset detection functions. */
57 class OnsetDetectionFunction 57 class OnsetDetectionFunction
58 { 58 {
59 public: 59 public:
60 60
61 /** Constructor that defaults the onset detection function type to ComplexSpectralDifferenceHWR
62 * and the window type to HanningWindow
63 * @param hopSize_ the hop size in audio samples
64 * @param frameSize_ the frame size in audio samples
65 */
66 OnsetDetectionFunction(int hopSize_,int frameSize_);
67
68
61 /** Constructor 69 /** Constructor
62 * @param hopSize_ the hop size in audio samples 70 * @param hopSize_ the hop size in audio samples
63 * @param frameSize_ the frame size in audio samples 71 * @param frameSize_ the frame size in audio samples
64 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) 72 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType)
65 * @param windowType the type of window to use (see WindowType) 73 * @param windowType the type of window to use (see WindowType)
66 */ 74 */
67 OnsetDetectionFunction(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType); 75 OnsetDetectionFunction(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType_);
68 76
69 /** Destructor */ 77 /** Destructor */
70 ~OnsetDetectionFunction(); 78 ~OnsetDetectionFunction();
79
80 /** Initialisation function for only updating hop size and frame size (and not window type
81 * or onset detection function type
82 * @param hopSize_ the hop size in audio samples
83 * @param frameSize_ the frame size in audio samples
84 */
85 void initialise(int hopSize_,int frameSize_);
71 86
72 /** Initialisation Function 87 /** Initialisation Function
73 * @param hopSize_ the hop size in audio samples 88 * @param hopSize_ the hop size in audio samples
74 * @param frameSize_ the frame size in audio samples 89 * @param frameSize_ the frame size in audio samples
75 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) 90 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType)
76 * @param windowType the type of window to use (see WindowType) 91 * @param windowType the type of window to use (see WindowType)
77 */ 92 */
78 void initialise(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType); 93 void initialise(int hopSize_,int frameSize_,int onsetDetectionFunctionType_,int windowType_);
79 94
80 /** Process input frame and calculate detection function sample 95 /** Process input frame and calculate detection function sample
81 * @param buffer a pointer to an array containing the audio samples to be processed 96 * @param buffer a pointer to an array containing the audio samples to be processed
82 * @returns the onset detection function sample 97 * @returns the onset detection function sample
83 */ 98 */
151 double pi; /**< pi, the constant */ 166 double pi; /**< pi, the constant */
152 167
153 int frameSize; /**< audio framesize */ 168 int frameSize; /**< audio framesize */
154 int hopSize; /**< audio hopsize */ 169 int hopSize; /**< audio hopsize */
155 int onsetDetectionFunctionType; /**< type of detection function */ 170 int onsetDetectionFunctionType; /**< type of detection function */
171 int windowType; /**< type of window used in calculations */
156 172
157 fftw_plan p; /**< fftw plan */ 173 fftw_plan p; /**< fftw plan */
158 fftw_complex *complexIn; /**< to hold complex fft values for input */ 174 fftw_complex *complexIn; /**< to hold complex fft values for input */
159 fftw_complex *complexOut; /**< to hold complex fft values for output */ 175 fftw_complex *complexOut; /**< to hold complex fft values for output */
160 176