def dct_spectrum(spec):
ncep = spec.shape[<NUM_LIT:0>]<EOL>dctm = np.zeros((ncep, ncep))<EOL>for i in range(ncep):<EOL><INDENT>dctm[i, :] = np.cos(i * np.arange(<NUM_LIT:1>, <NUM_LIT:2> * ncep, <NUM_LIT:2>) / (<NUM_LIT:2> * ncep) * np.pi) * np.sqrt(<NUM_LIT:2> / ncep)<EOL><DEDENT>dctm *= <NUM_LIT><EOL>cep = np.dot(dctm, (<NUM_LIT:10> * np.log10(spec + np.spacing(<NUM_LIT:1>))))<EOL>return cep<EOL>
Convert a spectrum into a cepstrum via type-III DCT (following HTK).

    Parameters
    ----------
    spec : array
        Spectrum to perform a DCT on.

    Returns
    -------
    array
        Cepstrum of the input spectrum.