python-speech-features is a Python library designed for extracting common speech features used in Automatic Speech Recognition (ASR). It provides functionalities to compute Mel-Frequency Cepstral Coefficients (MFCCs), filterbank energies, log filterbank energies, and spectral subband centroids. The current stable version on PyPI is 0.6, last released in 2017, with a slightly newer v0.6.1 tag on its GitHub repository from 2020. The project maintains a slow release cadence, but its core functionalities remain widely used for fundamental speech feature extraction.
pip install python-speech-featuresVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to generate a simple audio signal, save it as a WAV file, and then use `python-speech-features` to extract both Mel-Frequency Cepstral Coefficients (MFCCs) and log Mel-filterbank energies. It uses `scipy.io.wavfile` to handle audio file I/O.
For the very latest version, consider installing directly from the GitHub repository: `pip install git+https://github.com/jameslyons/python_speech_features.git`.
Explicitly convert signal data types (e.g., `signal.astype(np.float32)`) if required by other libraries. Consult the documentation of both `python-speech-features` and any other library being used for parameter details and expected outputs. Be mindful that `numcep` is effectively capped by `nfilt` in `python-speech-features`.
Ensure that `nfft` is greater than or equal to `winlen * samplerate`. For example, if `winlen=0.025` and `samplerate=16000`, the frame length is 400 samples. `nfft` should be set to 512, 1024, or a higher power of 2 that accommodates this length.