Open joelle-o-world opened 4 years ago
"...this implementation uses the DCT-II with a scaling factor of 2."
feat = dct(feat, type=2, axis=1, norm='ortho')[:,:numcep]
from python lib
DCT-II ✅
Type II
There are several definitions of the DCT-II; we use the following (for norm=None):
N-1 y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N. n=0
If
norm='ortho'
,y[k]
is multiplied by a scaling factor f:f = sqrt(1/(4*N)) if k = 0, f = sqrt(1/(2*N)) otherwise.
Which makes the corresponding matrix of coefficients orthonormal (
OO' = Id
).
https://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.fftpack.dct.html
Looks like there may be some deviation between the two libraries in terms of scaling factor
Perhaps the "scaling factor of 2" referred to by the npm package dct, is the 2 *
in:
N-1
y[k] = 2* sum x[n]*cos(pi*k*(2n+1)/(2*N)), 0 <= k < N.
n=0
But perhaps not, will need to try it both ways
Discrete cosine transform package used: https://www.npmjs.com/package/dct