PyHTK
HTK features in Python
This project contains a Python implementation of the MFCC features as computed by HTK.
What is HTK?
HTK is a respected toolkit used mainly by the speech community to perform research in speech recognition. Although quite old, many newer systems emulate the same feature extraction pipeline as used in HTK. Besides being thouroughly tested it is also well documented in a manual known as the HTK Book.
You can find more information about HTK on their official website: http://htk.eng.cam.ac.uk/
What is MFCC?
The MFCC feature set, as implemented in this little project, is one of the best performing techniques for modeling speech in tasks like speech recognition. While there may be others that are margianlly better in specific cases, MFCCs remain as a strong baseline for many standard benchmarks.
How to use?
Simply copy the HTKFeat.py file to your project and use the MFCC_HTK class from within. The class is throughly documented.
If you prefer, you can also install the file as a library:
pip install https://github.com/danijel3/PyHTK.git
Then you can access the class in your project using code like this:
# import the main class
from pyhtk.HTKFeat import MFCC_HTK
# these are additional libraries for this example
from pathlib import Path
import numpy as np
# contstruct the main mfcc object
# you can also change some arguments inside
mfcc = MFCC_HTK()
# load the raw audio file
sig = mfcc.load_raw_signal(Path("file.raw"))
# here we calculate the MFCC+energy, deltas and acceleration coefficients
feat = mfcc.get_feats(sig)
delta = mfcc.get_delta(feat, 2)
acc = mfcc.get_delta(delta, 2)
# merge the MFCCs and deltas together to get 39 features
feat = np.hstack((feat, delta, acc))
print(feat.shape)
How does it work?
Open the HTKFeaturesExplained notebook in the notebooks folder and play around with it. Everythin is explained there.
Also the the test.py script in the tests folder compares this library to the original HTK code so you can validate its accuracy.
Who made this?
If you have any questions, feel free to contact me at: danijel@pja.edu.pl
Metadata
Release files for pyhtk 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pyhtk-0.1.0.tar.gz | 9.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyhtk-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.6 kB
Release files / pyhtk-0.1.0.tar.gz
| Download URL | pyhtk-0.1.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b75a15d67de39ae323f5f8c69ac26480fabd366fe4d8dfc5434bc8c94e600e05
|
|
BLAKE2b-256 checksum How to use checksums |
5bc6385551a85d6bb374be0393f60c3a5ce783912b20e9b9a4c4da4596b7f291
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2025.
Transparency logRelease files / pyhtk-0.1.0-py3-none-any.whl
| Download URL | pyhtk-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
33fa46118832e3a1d5a8a6ca49df8bed87a23357d91c6aa200931fdca9dd0b5f
|
|
BLAKE2b-256 checksum How to use checksums |
67aa2b19255defb4b72f53fcb389d46f3748bfb8e50313f3880cb0819f180dbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2025.
Transparency logSecurity for pyhtk 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pyhtk-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 4, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.