Mercurial > hg > btrack
comparison src/OnsetDetectionFunction.h @ 117:ca2d83d29814 tip master
Merge branch 'release/1.0.5'
author | Adam Stark <adamstark.uk@gmail.com> |
---|---|
date | Fri, 18 Aug 2023 20:07:33 +0200 |
parents | 8fb1610c9192 |
children |
comparison
equal
deleted
inserted
replaced
96:c58f01834337 | 117:ca2d83d29814 |
---|---|
68 /** Constructor that defaults the onset detection function type to ComplexSpectralDifferenceHWR | 68 /** Constructor that defaults the onset detection function type to ComplexSpectralDifferenceHWR |
69 * and the window type to HanningWindow | 69 * and the window type to HanningWindow |
70 * @param hopSize_ the hop size in audio samples | 70 * @param hopSize_ the hop size in audio samples |
71 * @param frameSize_ the frame size in audio samples | 71 * @param frameSize_ the frame size in audio samples |
72 */ | 72 */ |
73 OnsetDetectionFunction (int hopSize_, int frameSize_); | 73 OnsetDetectionFunction (int hopSize, int frameSize); |
74 | 74 |
75 | 75 |
76 /** Constructor | 76 /** Constructor |
77 * @param hopSize_ the hop size in audio samples | 77 * @param hopSize_ the hop size in audio samples |
78 * @param frameSize_ the frame size in audio samples | 78 * @param frameSize_ the frame size in audio samples |
79 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 79 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
80 * @param windowType the type of window to use (see WindowType) | 80 * @param windowType the type of window to use (see WindowType) |
81 */ | 81 */ |
82 OnsetDetectionFunction (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); | 82 OnsetDetectionFunction (int hopSize, int frameSize, int onsetDetectionFunctionType, int windowType); |
83 | 83 |
84 /** Destructor */ | 84 /** Destructor */ |
85 ~OnsetDetectionFunction(); | 85 ~OnsetDetectionFunction(); |
86 | 86 |
87 /** Initialisation function for only updating hop size and frame size (and not window type | 87 /** Initialisation function for only updating hop size and frame size (and not window type |
88 * or onset detection function type | 88 * or onset detection function type |
89 * @param hopSize_ the hop size in audio samples | 89 * @param hopSize_ the hop size in audio samples |
90 * @param frameSize_ the frame size in audio samples | 90 * @param frameSize_ the frame size in audio samples |
91 */ | 91 */ |
92 void initialise (int hopSize_, int frameSize_); | 92 void initialise (int hopSize, int frameSize); |
93 | 93 |
94 /** Initialisation Function | 94 /** Initialisation Function |
95 * @param hopSize_ the hop size in audio samples | 95 * @param hopSize_ the hop size in audio samples |
96 * @param frameSize_ the frame size in audio samples | 96 * @param frameSize_ the frame size in audio samples |
97 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 97 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
98 * @param windowType the type of window to use (see WindowType) | 98 * @param windowType the type of window to use (see WindowType) |
99 */ | 99 */ |
100 void initialise (int hopSize_, int frameSize_, int onsetDetectionFunctionType_, int windowType_); | 100 void initialise (int hopSize, int frameSize, int onsetDetectionFunctionType, int windowType); |
101 | 101 |
102 /** Process input frame and calculate detection function sample | 102 /** Process input frame and calculate detection function sample |
103 * @param buffer a pointer to an array containing the audio samples to be processed | 103 * @param buffer a pointer to an array containing the audio samples to be processed |
104 * @returns the onset detection function sample | 104 * @returns the onset detection function sample |
105 */ | 105 */ |
106 double calculateOnsetDetectionFunctionSample (double* buffer); | 106 double calculateOnsetDetectionFunctionSample (double* buffer); |
107 | 107 |
108 /** Set the detection function type | 108 /** Set the detection function type |
109 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) | 109 * @param onsetDetectionFunctionType_ the type of onset detection function to use - (see OnsetDetectionFunctionType) |
110 */ | 110 */ |
111 void setOnsetDetectionFunctionType (int onsetDetectionFunctionType_); | 111 void setOnsetDetectionFunctionType (int onsetDetectionFunctionType); |
112 | 112 |
113 private: | 113 private: |
114 | 114 |
115 /** Perform the FFT on the data in 'frame' */ | 115 /** Perform the FFT on the data in 'frame' */ |
116 void performFFT(); | 116 void performFFT(); |
205 std::vector<double> prevMagSpec; /**< previous magnitude spectrum */ | 205 std::vector<double> prevMagSpec; /**< previous magnitude spectrum */ |
206 | 206 |
207 std::vector<double> phase; /**< FFT phase values */ | 207 std::vector<double> phase; /**< FFT phase values */ |
208 std::vector<double> prevPhase; /**< previous phase values */ | 208 std::vector<double> prevPhase; /**< previous phase values */ |
209 std::vector<double> prevPhase2; /**< second order previous phase values */ | 209 std::vector<double> prevPhase2; /**< second order previous phase values */ |
210 | |
211 }; | 210 }; |
212 | 211 |
213 | 212 |
214 #endif | 213 #endif |