spafe.utils.cepstral

spafe.utils.cepstral.cep2spec(cep, ncep, nfreq, dct_type=2)[source]

Reverse the cepstrum to recover a spectrum.

Parameters:
  • cep (array) – cepstral data to convert to spectral data.
  • ncep (int) – number of cepstrals.
  • nfreq (int) – number of points to reconstruct in spectrum.
  • dct_type (int) – the discrete cosine transform type. Default is 2.
Returns
2d-array spec, spectrum matrix 2d-array idctm, the IDCT matrix that spec was multiplied by to give cep.
spafe.utils.cepstral.cmn(x)[source]

Mean normalization.

Parameters:x (array) – input data.
Returns:array with the mean normalized data.
spafe.utils.cepstral.cms(x)[source]

Mean Substraction: Centering

Parameters:x (array) – input data.
Returns:array with the centered data.
spafe.utils.cepstral.cmvn(x)[source]

Mean Variance Normalisation

Parameters:x (array) – input data.
Returns:array with the mean and variance normalized data.
spafe.utils.cepstral.cvn(x)[source]

Variance Normalisation: Standardization

Parameters:x (array) – input data.
Returns:array with the variance normalized data.
spafe.utils.cepstral.deltas(x, w=9)[source]

Calculate the deltas (derivatives) of an input sequence with a W-points window (W odd, default 9) using a simple linear slope. This mirrors the delta calculation performed in feacalc etc. Each row of X is filtered separately.

Parameters:
  • x (array) – input sequence
  • w (int) – window size to use in the derivatives calculation. Default is 9.
Returns:

2d-arrays containing the derivatives values.

spafe.utils.cepstral.lifter_ceps(cepstra, L=22)[source]

Apply a cepstral lifter the the matrix of cepstra. This has the effect of increasing the magnitude of the high frequency DCT coeffs.

Parameters:
  • cepstra (np.array) – the matrix of mel-cepstra, will be numframes * numcep in size.
  • L (int) – the liftering coefficient to use. Default is 22. L <= 0 disables lifter.
Returns:

liftered cepstra.

spafe.utils.cepstral.spec2cep(spec, ncep=9, dct_type=2)[source]

Calculate cepstra from spectral samples (in columns of spec).

Parameters:
  • spec (array) – spectral data to convert to cepstral.
  • ncep (int) – number of cepstrals. Default is 9.
  • dct_type (int) – the discrete cosine transform type. Default is 2.
Returns
2d-array ncep, cepstral rows 2d-array dctm, the DCT matrix that spec was multiplied by to give cep.