while True:
samples, read = s()
if o(samples):
- print "%f" % o.get_last_onset_s()
- onsets.append(o.get_last_onset())
+ print "%f" % o.get_last_s()
+ onsets.append(o.get_last())
total_frames += read
if read < hop_s: break
#print len(onsets)
total_frames = 0
while True:
samples, read = s()
- is_onset = o(samples)
- if is_onset:
- this_onset = o.get_last_onset()
- print "%f" % (this_onset / float(samplerate))
- onsets.append(this_onset)
+ if o(samples):
+ print "%f" % (o.get_last_s())
+ onsets.append(o.get_last())
# keep some data to plot it later
new_maxes = (abs(samples.reshape(hop_s/downsample, downsample))).max(axis=0)
allsamples_max = hstack([allsamples_max, new_maxes])
//AUBIO_DBG ("silent onset, not marking as onset\n");
isonset = 0;
} else {
- uint_t new_onset = o->total_frames + isonset * o->hop_size;
+ uint_t new_onset = o->total_frames + (uint_t)ROUND(isonset * o->hop_size);
if (o->last_onset + o->minioi < new_onset) {
//AUBIO_DBG ("accepted detection, marking as onset\n");
o->last_onset = new_onset;
return;
}
-smpl_t aubio_onset_get_last_onset (aubio_onset_t *o)
+uint_t aubio_onset_get_last (aubio_onset_t *o)
{
return o->last_onset - o->delay;
}
-smpl_t aubio_onset_get_last_onset_s (aubio_onset_t *o)
+smpl_t aubio_onset_get_last_s (aubio_onset_t *o)
{
- return aubio_onset_get_last_onset (o) / (smpl_t) (o->samplerate);
+ return aubio_onset_get_last (o) / (smpl_t) (o->samplerate);
}
-smpl_t aubio_onset_get_last_onset_ms (aubio_onset_t *o)
+smpl_t aubio_onset_get_last_ms (aubio_onset_t *o)
{
- return aubio_onset_get_last_onset_s (o) / 1000.;
+ return aubio_onset_get_last_s (o) / 1000.;
}
uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) {
\param o onset detection object as returned by ::new_aubio_onset
*/
-smpl_t aubio_onset_get_last_onset (aubio_onset_t *o);
+uint_t aubio_onset_get_last (aubio_onset_t *o);
/** get the time of the latest onset detected, in seconds
\param o onset detection object as returned by ::new_aubio_onset
*/
-smpl_t aubio_onset_get_last_onset_s (aubio_onset_t *o);
+smpl_t aubio_onset_get_last_s (aubio_onset_t *o);
/** get the time of the latest onset detected, in milliseconds
\param o onset detection object as returned by ::new_aubio_onset
*/
-smpl_t aubio_onset_get_last_onset_ms (aubio_onset_t *o);
+smpl_t aubio_onset_get_last_ms (aubio_onset_t *o);
/** set onset detection silence threshold