Created
December 18, 2015 11:10
-
-
Save multivac61/4844b58a9c4594102c2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def freq_from_CEPS(sig, fs): | |
N = len(sig) | |
windowed = sig * blackmanharris(N) | |
spectrum = np.fft.rfft(windowed, fs) | |
spectrum[spectrum == 0] = EPSILON | |
log_spectrum = np.log(np.abs(spectrum)) | |
ceps = np.fft.irfft(log_spectrum) | |
start = int(fs / HIGH_FREQ) | |
end = int(fs / LOW_FREQ) | |
i_peak = np.argmax(ceps[start:end]) | |
i_interp = interpolate(ceps[start:end+1], i_peak)[0] | |
return fs / (i_interp + start) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the interpolate function is part of numpy/scipy???