From: Thomas Fillon Date: Tue, 11 Mar 2014 09:21:03 +0000 (+0100) Subject: AubioPitch: prevent NaN in result by converting them to zero X-Git-Tag: 0.5.5~3^2^2~22 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=1a35d497e300434e3a9692498232620b72d22902;p=timeside.git AubioPitch: prevent NaN in result by converting them to zero --- 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