spafe.features.lpc

spafe.features.lpc.do_lpc(x, model_order=8)[source]

Compute the autoregressive model from spectral magnitude samples.

Parameters:
  • x (array) – array of the audio signal to process.
  • model_order (int) – order of the model to compute.
Returns:

array of the autoregressive model

spafe.features.lpc.lpc(sig, fs=16000, num_ceps=13, pre_emph=0, pre_emph_coeff=0.97, win_type='hann', win_len=0.025, win_hop=0.01, do_rasta=True, dither=1)[source]

Compute the LINEAR PREDICTIVE COEFFICIENTS (LPC) from an audio signal.

Parameters:
  • sig (array) – a mono audio signal (Nx1) from which to compute features.
  • fs (int) – the sampling frequency of the signal we are working with. Default is 16000.
  • num_ceps (int) – number of cepstra to return(order of the model to compute). Default is 13.
  • pre_emph (int) – apply pre-emphasis if 1. Default is 1.
  • pre_emph_coeff (float) – apply pre-emphasis filter [1 -pre_emph] (0 = none). Default is 0.97.
  • win_type (float) – window type to apply for the windowing. Default is hanning.
  • win_len (float) – window length in sec. Default is 0.025.
  • win_hop (float) – step between successive windows in sec. Default is 0.01.
  • do_rasta (int) – if 1 then apply rasta filtering. Default is 0.
  • lifter (int) – apply liftering if value > 0. Default is 22.
  • normalize (int) – apply normalization if 1. Default is 0.
  • dither (int) – 1 = add offset to spectrum as if dither noise. Default is 0.
Returns:

2d array of LPC features (num_frames x num_ceps)

Return type:

(array)

spafe.features.lpc.lpc2cep(a, nout=0)[source]
convert LPC coefficients directly to cepstral values.
  • convert the LPC ‘a’ coefficients in each column of lpcs into frames of cepstra.
Parameters:
  • a (array) – cepstral values.
  • nout (int) – number of cepstra to produce
Returns:

array of LPC coefficients. Default size(lpcs, 1)

spafe.features.lpc.lpc2spec(lpcs, nout=17, FMout=False)[source]

convert LPC coefficients back into spectra by sampling the z-plane.

Parameters:
  • lpcs (array) – array including the LPC coefficients.
  • nout (int) – number of freq channels, default 17 (i.e. for 8 kHz)
  • FMout (bool) –
Returns:

list including the features, F and M

spafe.features.lpc.lpcc(sig, fs=16000, num_ceps=13, pre_emph=1, pre_emph_coeff=0.97, win_type='hann', win_len=0.025, win_hop=0.01, do_rasta=True, lifter=1, normalize=1, dither=1)[source]

Compute the LINEAR PREDICTIVE CEPSTRAL COEFFICIENTS (LPCC) from an audio signal.

Parameters:
  • sig (array) – a mono audio signal (Nx1) from which to compute features.
  • fs (int) – the sampling frequency of the signal we are working with. Default is 16000.
  • num_ceps (float) – number of cepstra to return (order of the model to compute). Default is 13.
  • pre_emph (int) – apply pre-emphasis if 1. Default is 1.
  • pre_emph_coeff (float) – apply pre-emphasis filter [1 -pre_emph] (0 = none). Default is 0.97.
  • win_type (float) – window type to apply for the windowing. Default is hanning.
  • win_len (float) – window length in sec. Default is 0.025.
  • win_hop (float) – step between successive windows in sec. Default is 0.01.
  • do_rasta (int) – if 1 then apply rasta filtering. Default is 0.
  • lifter (int) – apply liftering if value > 0. Default is 22.
  • normalize (int) – apply normalization if 1. Default is 0.
  • dither (int) – 1 = add offset to spectrum as if dither noise. Default is 0.
Returns:

2d array of LPCC features (num_frames x num_ceps)

Return type:

(array)