33
44def frequencyToMelSpace (freq ):
55 """
6- Convert a frequency in Hz to Mel space value
6+ Convert a frequency in Hz to an HTK Mel-space value.
7+
8+ The conversion is ``1127 * log(1 + freq / 700)``.
79
810 :param freq: Frequency in Hz.
911 :type freq: float
@@ -27,7 +29,11 @@ def melSpaceToFrequency(mels):
2729
2830def melFilterMatrix (dtype ,fmin , fmax , numOfMelFilters ,fs ,FFTSize ):
2931 """
30- Sparse matrix in a specific format and encoding the filters in Mel space
32+ Generate a sparse matrix encoding triangular filters in Mel space.
33+
34+ Filter centers are equally spaced on the HTK Mel scale. The triangular
35+ weights are evaluated at the FFT bin center frequencies and are not area
36+ normalized.
3137
3238 :param dtype: The datatype to use for the matrix coefficients.
3339 :type dtype: int
@@ -91,7 +97,12 @@ def melFilterMatrix(dtype,fmin, fmax, numOfMelFilters,fs,FFTSize):
9197
9298def dctMatrix (dtype ,numOfDctOutputs , numOfMelFilters ):
9399 """
94- Dct matrix in a specific format
100+ Generate the type-II DCT matrix used by the MFCC helper.
101+
102+ For ``M = numOfMelFilters``, element ``(k, n)`` is
103+ ``sqrt(2 / M) * cos(pi * k * (n + 0.5) / M)``. The ``sqrt(2 / M)``
104+ factor is applied to every row, including ``k = 0``. This differs from an
105+ orthonormal DCT-II, whose first row is scaled by ``sqrt(1 / M)``.
95106
96107 :param dtype: The datatype to use for the matrix coefficients.
97108 :type dtype: int
0 commit comments