Audio buffer finite error after butter filtering (Scipy)

Viewed 2262

I have an audio signal which I pass through a butter bandpass filter:

def bandpass_filter(y, sr, lowcut, highcut):
  # Setup parameters.
  nyquist_rate = sr / 2.
  filter_order = 1001
  normalized_low = lowcut / nyquist_rate
  normalized_high = highcut / nyquist_rate

  b, a = butter(filter_order, [normalized_low, normalized_high], btype='bandpass')

  y = lfilter(b, a, y)
  return y

I then use this returned, filtered signal to detect some pitches using a library called Librosa.

When I call:

  pitches, magnitudes = librosa.piptrack(y=y, sr=sr, fmin=fmin, fmax=fmax)

Where y is the filtered audio signal, I get this error:

librosa.util.exceptions.ParameterError
ParameterError: Audio buffer is not finite everywhere

Which basically comes from this check:

if not np.isfinite(y).all():
    raise ParameterError('Audio buffer is not finite everywhere')

Why did this happen?

1 Answers
Related