Open pavlos163 opened 7 years ago
Are you feeding a zero-length array to freq_from_hps()
?
freq_from_hps(array([]), 48000)
does the same thing?
@pavlos163 did you fix that? if not, @endolith there is some workaround?
def get_frequency_from_fft(sig, fs = 44100) -> str:
"""
Estimate frequency from peak of FFT
"""
# Compute Fourier transform of windowed signal
windowed = sig * blackmanharris(len(sig))
f = np.fft.rfft(windowed)
# Find the peak and interpolate to get a more accurate peak
#i = np.argmax(abs(f)) # Just use this for less-accurate, naive version
i = np.argmax(abs(f))
j = np.log(abs(f))
if j[i] < 0:
r = '0'
else:
i = _parabolic(j, i)[0]
...
I made this.
I get a ValueError when I try to call
freq_from_hps
on a filtered segments of this audio file. I segment and filter my signal like this before callingfreq_from_hps
on every segment:I specifically get this error:
Any ideas?