]> git.parisson.com Git - timeside.git/commitdiff
timeside/analyzer/aubio_pitch.py: add confidence
authorPaul Brossier <piem@piem.org>
Sun, 1 Dec 2013 18:55:01 +0000 (13:55 -0500)
committerPaul Brossier <piem@piem.org>
Sun, 1 Dec 2013 18:55:01 +0000 (13:55 -0500)
timeside/analyzer/aubio_pitch.py

index 46ad3d3e8ec4980d0567d2930d9a51359f19a646..d4a53200c2c083b7e8c1e90fa7b8690e364656dc 100644 (file)
@@ -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)