2

How can I extract CQT from audio with sampling rate 8000 Hz (librosa)

I wrote following codes.

sound_clip, s = librosa.load(fn, sr=8000)
cqtpec = librosa.cqt(y=sound_clip, sr=s)

But there was an error.

librosa.util.exceptions.ParameterError: Filter pass-band lies beyond Nyquist

I wanna extract CQT feature from audio with sampling rate 8000 Hz.

HS Cho
  • 91
  • 1
  • 2
  • 4

1 Answers1

3

Use a lower n_bins or a lower fmin. With the default fmin of 32.7Hz (musical C1), n_bins = 84, and bins_per_octave = 12, the highest bin falls 7 octaves higher, at 4186Hz (C8), but with a sampling rate of 8000Hz you can only deal with frequencies up to 4000Hz, so if you keep fmin the same, n_bins needs to be no more than 83.

hobbs
  • 223,387
  • 19
  • 210
  • 288