Changeset 483b883
- Timestamp:
- Apr 9, 2013, 7:54:52 PM (12 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, pitchshift, sampler, timestretch, yinfft+
- Children:
- 9c9202f
- Parents:
- 8b884ef
- Location:
- src/tempo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tempo/tempo.c
r8b884ef r483b883 46 46 uint_t step; /** dfframe hopsize */ 47 47 uint_t samplerate; /** sampling rate of the signal */ 48 uint_t hop_size; /** get hop_size */ 49 uint_t total_frames; /** total frames since beginning */ 50 uint_t last_beat; /** time of latest detected beat, in samples */ 51 uint_t delay; /** delay to remove to last beat, in samples */ 48 52 }; 49 53 … … 86 90 /* test for silence */ 87 91 if (aubio_silence_detection(input, o->silence)==1) { 88 tempo->data[1] = 0; /* unset onset */ 92 //tempo->data[0] = 0; /* unset onset */ 93 } else { 94 o->last_beat = o->total_frames + (uint_t)ROUND(tempo->data[0] * o->hop_size); 89 95 } 90 96 } 91 97 } 98 o->total_frames += o->hop_size; 99 return; 100 } 101 102 uint_t aubio_tempo_get_last (aubio_tempo_t *o) 103 { 104 return o->last_beat - o->delay; 105 } 106 107 smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o) 108 { 109 return aubio_tempo_get_last (o) / (smpl_t) (o->samplerate); 110 } 111 112 smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o) 113 { 114 return aubio_tempo_get_last_s (o) / 1000.; 115 } 116 117 uint_t aubio_tempo_set_delay(aubio_tempo_t * o, uint_t delay) { 118 o->delay = delay; 119 return AUBIO_OK; 120 } 121 122 uint_t aubio_tempo_get_delay(aubio_tempo_t * o) { 123 return o->delay; 92 124 } 93 125 … … 115 147 o->silence = -90.; 116 148 o->blockpos = 0; 149 o->total_frames = 0; 150 o->last_beat = 0; 151 o->delay = 0; 152 o->hop_size = hop_size; 117 153 o->dfframe = new_fvec(o->winlen); 118 154 o->fftgrain = new_cvec(buf_size); -
src/tempo/tempo.h
r8b884ef r483b883 61 61 void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo); 62 62 63 /** get the time of the latest beat detected, in samples 64 65 \param o tempo detection object as returned by ::new_aubio_tempo 66 67 */ 68 uint_t aubio_tempo_get_last (aubio_tempo_t *o); 69 70 /** get the time of the latest beat detected, in seconds 71 72 \param o tempo detection object as returned by ::new_aubio_tempo 73 74 */ 75 smpl_t aubio_tempo_get_last_s (aubio_tempo_t *o); 76 77 /** get the time of the latest beat detected, in milliseconds 78 79 \param o tempo detection object as returned by ::new_aubio_tempo 80 81 */ 82 smpl_t aubio_tempo_get_last_ms (aubio_tempo_t *o); 83 63 84 /** set tempo detection silence threshold 64 85
Note: See TracChangeset
for help on using the changeset viewer.