From 5c04ef5c50eaad0deac782a750a9cedbb9c3ca54 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 1 Dec 2013 13:55:01 -0500 Subject: [PATCH] timeside/analyzer/aubio_pitch.py: add confidence --- timeside/analyzer/aubio_pitch.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/timeside/analyzer/aubio_pitch.py b/timeside/analyzer/aubio_pitch.py index 46ad3d3..d4a5320 100644 --- a/timeside/analyzer/aubio_pitch.py +++ b/timeside/analyzer/aubio_pitch.py @@ -41,11 +41,12 @@ class AubioPitch(Analyzer): samplerate, blocksize, totalframes) - self.p = pitch("default", self.input_blocksize, self.input_stepsize, + self.aubio_pitch = pitch("default", self.input_blocksize, self.input_stepsize, samplerate) - self.p.set_unit("freq") + self.aubio_pitch.set_unit("freq") self.block_read = 0 self.pitches = [] + self.pitch_confidences = [] @staticmethod @interfacedoc @@ -69,7 +70,8 @@ class AubioPitch(Analyzer): @frames_adapter def process(self, frames, eod=False): #time = self.block_read * self.input_stepsize * 1. / self.samplerate() - self.pitches += [self.p(frames)[0]] + self.pitches += [self.aubio_pitch(frames)[0]] + self.pitch_confidences += [self.aubio_pitch.get_confidence()] self.block_read += 1 return frames, eod @@ -81,3 +83,7 @@ class AubioPitch(Analyzer): pitch.data_object.value = self.pitches self.pipe.results.add(pitch) + + pitch_confidence = self.new_result(data_mode='value', time_mode='framewise') + pitch_confidence.data_object.value = self.pitch_confidences + self.pipe.results.add(pitch_confidence) -- 2.39.5