Created
January 13, 2020 15:38
-
-
Save RicherMans/d760c045e34e30e7d8c4d0de1843d79d to your computer and use it in GitHub Desktop.
Python librosa implementation of https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=8865624
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
import librosa | |
import scipy | |
import numpy as np | |
def cmc(y, sr, P=12, n_level=7, eps=1e-12, **kwargs): | |
log_abs_power_cqt = np.log( | |
np.abs(librosa.core.cqt(y=y, sr=sr, **kwargs))**2 + eps) | |
cmc_levels = [] | |
for _ in range(n_level): | |
octave = scipy.fftpack.dct(log_abs_power_cqt, | |
norm='ortho', | |
axis=0, | |
type=2) | |
cmc = octave[:P] | |
log_abs_power_cqt = octave[P:] # residual to next dct | |
cmc_levels.append(cmc) | |
return np.concatenate(cmc_levels, 0).T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment