From 1a35d497e300434e3a9692498232620b72d22902 Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Tue, 11 Mar 2014 10:21:03 +0100 Subject: [PATCH] AubioPitch: prevent NaN in result by converting them to zero --- timeside/analyzer/aubio_pitch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/timeside/analyzer/aubio_pitch.py b/timeside/analyzer/aubio_pitch.py index cec7291..6769445 100644 --- a/timeside/analyzer/aubio_pitch.py +++ b/timeside/analyzer/aubio_pitch.py @@ -24,7 +24,7 @@ from .core import Analyzer from ..api import IAnalyzer from preprocessors import downmix_to_mono, frames_adapter from aubio import pitch - +import numpy as np class AubioPitch(Analyzer): """Aubio Pitch estimation analyzer""" @@ -72,7 +72,7 @@ class AubioPitch(Analyzer): def process(self, frames, eod=False): #time = self.block_read * self.input_stepsize * 1. / self.samplerate() self.pitches += [self.aubio_pitch(frames)[0]] - self.pitch_confidences += [self.aubio_pitch.get_confidence()] + self.pitch_confidences += [np.nan_to_num(self.aubio_pitch.get_confidence())] self.block_read += 1 return frames, eod -- 2.39.5