- Timestamp:
- Mar 10, 2017, 2:26:32 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
- Children:
- ee8a57c
- Parents:
- 00d0275 (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/onset
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/onset/onset.c
r00d0275 r155cc10 52 52 53 53 /* execute onset detection function on iput buffer */ 54 void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset)54 void aubio_onset_do (aubio_onset_t *o, const fvec_t * input, fvec_t * onset) 55 55 { 56 56 smpl_t isonset = 0; … … 100 100 } 101 101 102 uint_t aubio_onset_get_last ( aubio_onset_t *o)102 uint_t aubio_onset_get_last (const aubio_onset_t *o) 103 103 { 104 104 return o->last_onset - o->delay; 105 105 } 106 106 107 smpl_t aubio_onset_get_last_s ( aubio_onset_t *o)107 smpl_t aubio_onset_get_last_s (const aubio_onset_t *o) 108 108 { 109 109 return aubio_onset_get_last (o) / (smpl_t) (o->samplerate); 110 110 } 111 111 112 smpl_t aubio_onset_get_last_ms ( aubio_onset_t *o)112 smpl_t aubio_onset_get_last_ms (const aubio_onset_t *o) 113 113 { 114 114 return aubio_onset_get_last_s (o) * 1000.; … … 131 131 } 132 132 133 smpl_t aubio_onset_get_silence( aubio_onset_t * o) {133 smpl_t aubio_onset_get_silence(const aubio_onset_t * o) { 134 134 return o->silence; 135 135 } … … 140 140 } 141 141 142 smpl_t aubio_onset_get_threshold( aubio_onset_t * o) {142 smpl_t aubio_onset_get_threshold(const aubio_onset_t * o) { 143 143 return aubio_peakpicker_get_threshold(o->pp); 144 144 } … … 149 149 } 150 150 151 uint_t aubio_onset_get_minioi( aubio_onset_t * o) {151 uint_t aubio_onset_get_minioi(const aubio_onset_t * o) { 152 152 return o->minioi; 153 153 } 154 154 155 155 uint_t aubio_onset_set_minioi_s(aubio_onset_t * o, smpl_t minioi) { 156 return aubio_onset_set_minioi (o, minioi * o->samplerate);157 } 158 159 smpl_t aubio_onset_get_minioi_s( aubio_onset_t * o) {156 return aubio_onset_set_minioi (o, (uint_t)ROUND(minioi * o->samplerate)); 157 } 158 159 smpl_t aubio_onset_get_minioi_s(const aubio_onset_t * o) { 160 160 return aubio_onset_get_minioi (o) / (smpl_t) o->samplerate; 161 161 } … … 165 165 } 166 166 167 smpl_t aubio_onset_get_minioi_ms( aubio_onset_t * o) {167 smpl_t aubio_onset_get_minioi_ms(const aubio_onset_t * o) { 168 168 return aubio_onset_get_minioi_s (o) * 1000.; 169 169 } … … 174 174 } 175 175 176 uint_t aubio_onset_get_delay( aubio_onset_t * o) {176 uint_t aubio_onset_get_delay(const aubio_onset_t * o) { 177 177 return o->delay; 178 178 } … … 182 182 } 183 183 184 smpl_t aubio_onset_get_delay_s( aubio_onset_t * o) {184 smpl_t aubio_onset_get_delay_s(const aubio_onset_t * o) { 185 185 return aubio_onset_get_delay (o) / (smpl_t) o->samplerate; 186 186 } … … 190 190 } 191 191 192 smpl_t aubio_onset_get_delay_ms( aubio_onset_t * o) {192 smpl_t aubio_onset_get_delay_ms(const aubio_onset_t * o) { 193 193 return aubio_onset_get_delay_s (o) * 1000.; 194 194 } 195 195 196 smpl_t aubio_onset_get_descriptor( aubio_onset_t * o) {196 smpl_t aubio_onset_get_descriptor(const aubio_onset_t * o) { 197 197 return o->desc->data[0]; 198 198 } 199 199 200 smpl_t aubio_onset_get_thresholded_descriptor( aubio_onset_t * o) {200 smpl_t aubio_onset_get_thresholded_descriptor(const aubio_onset_t * o) { 201 201 fvec_t * thresholded = aubio_peakpicker_get_thresholded_input(o->pp); 202 202 return thresholded->data[0]; … … 204 204 205 205 /* Allocate memory for an onset detection */ 206 aubio_onset_t * new_aubio_onset (c har_t * onset_mode,206 aubio_onset_t * new_aubio_onset (const char_t * onset_mode, 207 207 uint_t buf_size, uint_t hop_size, uint_t samplerate) 208 208 { … … 213 213 AUBIO_ERR("onset: got hop_size %d, but can not be < 1\n", hop_size); 214 214 goto beach; 215 } else if ((sint_t)buf_size < 1) {216 AUBIO_ERR("onset: got buffer_size %d, but can not be < 1\n", buf_size);215 } else if ((sint_t)buf_size < 2) { 216 AUBIO_ERR("onset: got buffer_size %d, but can not be < 2\n", buf_size); 217 217 goto beach; 218 218 } else if (buf_size < hop_size) { 219 AUBIO_ERR("onset: hop size (%d) is larger than win size (%d)\n", buf_size, hop_size);219 AUBIO_ERR("onset: hop size (%d) is larger than win size (%d)\n", hop_size, buf_size); 220 220 goto beach; 221 221 } else if ((sint_t)samplerate < 1) { … … 232 232 o->pp = new_aubio_peakpicker(); 233 233 o->od = new_aubio_specdesc(onset_mode,buf_size); 234 if (o->od == NULL) goto beach_specdesc; 234 235 o->fftgrain = new_cvec(buf_size); 235 236 o->desc = new_fvec(1); … … 244 245 return o; 245 246 247 beach_specdesc: 248 del_aubio_peakpicker(o->pp); 249 del_aubio_pvoc(o->pv); 246 250 beach: 247 251 AUBIO_FREE(o); -
src/onset/onset.h
r00d0275 r155cc10 40 40 41 41 42 #ifndef _AUBIO_ONSET_H43 #define _AUBIO_ONSET_H42 #ifndef AUBIO_ONSET_H 43 #define AUBIO_ONSET_H 44 44 45 45 #ifdef __cplusplus … … 60 60 61 61 */ 62 aubio_onset_t * new_aubio_onset (c har_t * method,62 aubio_onset_t * new_aubio_onset (const char_t * method, 63 63 uint_t buf_size, uint_t hop_size, uint_t samplerate); 64 64 … … 89 89 90 90 */ 91 void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset);91 void aubio_onset_do (aubio_onset_t *o, const fvec_t * input, fvec_t * onset); 92 92 93 93 /** get the time of the latest onset detected, in samples … … 98 98 99 99 */ 100 uint_t aubio_onset_get_last ( aubio_onset_t *o);100 uint_t aubio_onset_get_last (const aubio_onset_t *o); 101 101 102 102 /** get the time of the latest onset detected, in seconds … … 107 107 108 108 */ 109 smpl_t aubio_onset_get_last_s ( aubio_onset_t *o);109 smpl_t aubio_onset_get_last_s (const aubio_onset_t *o); 110 110 111 111 /** get the time of the latest onset detected, in milliseconds … … 116 116 117 117 */ 118 smpl_t aubio_onset_get_last_ms ( aubio_onset_t *o);118 smpl_t aubio_onset_get_last_ms (const aubio_onset_t *o); 119 119 120 120 /** set onset detection adaptive whitening … … 150 150 151 151 */ 152 smpl_t aubio_onset_get_silence( aubio_onset_t * o);152 smpl_t aubio_onset_get_silence(const aubio_onset_t * o); 153 153 154 154 /** get onset detection function … … 158 158 159 159 */ 160 smpl_t aubio_onset_get_descriptor ( aubio_onset_t *o);160 smpl_t aubio_onset_get_descriptor (const aubio_onset_t *o); 161 161 162 162 /** get thresholded onset detection function … … 166 166 167 167 */ 168 smpl_t aubio_onset_get_thresholded_descriptor ( aubio_onset_t *o);168 smpl_t aubio_onset_get_thresholded_descriptor (const aubio_onset_t *o); 169 169 170 170 /** set onset detection peak picking threshold … … 237 237 238 238 */ 239 uint_t aubio_onset_get_minioi( aubio_onset_t * o);239 uint_t aubio_onset_get_minioi(const aubio_onset_t * o); 240 240 241 241 /** get minimum inter onset interval in seconds … … 246 246 247 247 */ 248 smpl_t aubio_onset_get_minioi_s( aubio_onset_t * o);248 smpl_t aubio_onset_get_minioi_s(const aubio_onset_t * o); 249 249 250 250 /** get minimum inter onset interval in milliseconds … … 255 255 256 256 */ 257 smpl_t aubio_onset_get_minioi_ms( aubio_onset_t * o);257 smpl_t aubio_onset_get_minioi_ms(const aubio_onset_t * o); 258 258 259 259 /** get delay in samples … … 264 264 265 265 */ 266 uint_t aubio_onset_get_delay( aubio_onset_t * o);266 uint_t aubio_onset_get_delay(const aubio_onset_t * o); 267 267 268 268 /** get delay in seconds … … 273 273 274 274 */ 275 smpl_t aubio_onset_get_delay_s( aubio_onset_t * o);275 smpl_t aubio_onset_get_delay_s(const aubio_onset_t * o); 276 276 277 277 /** get delay in milliseconds … … 282 282 283 283 */ 284 smpl_t aubio_onset_get_delay_ms( aubio_onset_t * o);284 smpl_t aubio_onset_get_delay_ms(const aubio_onset_t * o); 285 285 286 286 /** get onset peak picking threshold … … 290 290 291 291 */ 292 smpl_t aubio_onset_get_threshold( aubio_onset_t * o);292 smpl_t aubio_onset_get_threshold(const aubio_onset_t * o); 293 293 294 294 /** delete onset detection object … … 303 303 #endif 304 304 305 #endif /* _AUBIO_ONSET_H */305 #endif /* AUBIO_ONSET_H */ -
src/onset/peakpicker.c
r00d0275 r155cc10 186 186 */ 187 187 t->biquad = new_aubio_filter_biquad (0.15998789, 0.31997577, 0.15998789, 188 -0.59488894, 0.23484048); 188 // FIXME: broken since c9e20ca, revert for now 189 //-0.59488894, 0.23484048); 190 0.23484048, 0); 189 191 190 192 return t; -
src/onset/peakpicker.h
r00d0275 r155cc10 27 27 */ 28 28 29 #ifndef _AUBIO_PEAKPICK_H30 #define _AUBIO_PEAKPICK_H29 #ifndef AUBIO_PEAKPICK_H 30 #define AUBIO_PEAKPICK_H 31 31 32 32 #ifdef __cplusplus … … 55 55 #endif 56 56 57 #endif /* _AUBIO_PEAKPICK_H */57 #endif /* AUBIO_PEAKPICK_H */
Note: See TracChangeset
for help on using the changeset viewer.