From: Paul Brossier Date: Sat, 13 Apr 2013 16:34:37 +0000 (-0500) Subject: timeside/analyzer/aubio_{bpm,onset}.py: simplify, using get_last_s X-Git-Tag: 0.5.0~115^2~54 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=927c23072e7c75ebbba4629f00aa8ef67b79d8dc;p=timeside.git timeside/analyzer/aubio_{bpm,onset}.py: simplify, using get_last_s --- diff --git a/timeside/analyzer/aubio_bpm.py b/timeside/analyzer/aubio_bpm.py index b1537ce..226a9e6 100644 --- a/timeside/analyzer/aubio_bpm.py +++ b/timeside/analyzer/aubio_bpm.py @@ -58,11 +58,11 @@ class AubioBPM(Processor): def process(self, frames, eod=False): i = 0 while i < frames.shape[0]: - downmixed = frames[i:i+self.hop_s, :].sum(axis = -1) - isbeat = self.t(downmixed) - if isbeat: self.beats += [(isbeat[0] + self.block_read * self.hop_s ) / self.samplerate() ] - i += self.hop_s - self.block_read += 1 + downmixed = frames[i:i+self.hop_s, :].sum(axis = -1) + if self.t(downmixed): + self.beats += [self.t.get_last_s()] + i += self.hop_s + self.block_read += 1 return frames, eod def result(self): diff --git a/timeside/analyzer/aubio_onset.py b/timeside/analyzer/aubio_onset.py index 48bab84..dc0cf84 100644 --- a/timeside/analyzer/aubio_onset.py +++ b/timeside/analyzer/aubio_onset.py @@ -60,8 +60,8 @@ class AubioOnset(Processor): downmixed = frames[i:i+self.hop_s, :].sum(axis = -1) isonset = self.t(downmixed) if isonset: - #print self.t.get_last_onset_s() - self.onsets += [self.t.get_last_onset_s()] + #print self.t.get_last_s() + self.onsets += [self.t.get_last_s()] i += self.hop_s self.block_read += 1 return frames, eod