Skip to main content

This project contains a Python implementation of the MFCC features as computed by HTK.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhtk-0.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhtk-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pyhtk-0.1.0.tar.gz.

File metadata

  • Download URL: pyhtk-0.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhtk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b75a15d67de39ae323f5f8c69ac26480fabd366fe4d8dfc5434bc8c94e600e05
MD5 daed6d393b116dfa98e78227b791ace7
BLAKE2b-256 5bc6385551a85d6bb374be0393f60c3a5ce783912b20e9b9a4c4da4596b7f291

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhtk-0.1.0.tar.gz:

Publisher: python-publish.yml on danijel3/PyHTK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyhtk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pyhtk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyhtk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33fa46118832e3a1d5a8a6ca49df8bed87a23357d91c6aa200931fdca9dd0b5f
MD5 c2edf2759521893e1cced75f90418755
BLAKE2b-256 67aa2b19255defb4b72f53fcb389d46f3748bfb8e50313f3880cb0819f180dbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyhtk-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on danijel3/PyHTK

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page