Hidden Markov Models are a type of statistical model popular for modelling sequential systems (especially temporal sequences, or time series), but if you're looking to install HTK, you probably already know what they are, right?

What is HTK?

HTK (or Hidden Markov Model Toolkit) is a toolkit developed at the Speech Vision and Robotics Group, University of Cambridge. The tool is most commonly used for modelling speech systems, and therefore has some degree of specialization towards tasks of this nature, but is still frequently used for modeling other types of sequential systems.


Unfortunately, with the software being much older than existing popular Python libraries such as pomegranate and hmmlearn or R libraries like depmixS4, this also means that it is a bit more complicated to set up and start working with right away–especially for individuals not familiar with building C programs from source.

The toolkit installation procedure for macOS doesn't seem to work right out of the box due to some issues with C header files.

make all
make install

And that's all! But if you want to test the installation, you can run the demo code provided in the HTKDemo subdirectory of the samples folder you downloaded from the HTK website.

Before running this, you'll need to create some folders that the demo depends on. These commands should be executed in the HTKDemo folder:

# Create the necessary folders for the demo
mkdir proto test hmms/hmm.0 hmms/hmm.1 hmms/hmm.2
# Run the demo program
./runDemo configs/monPlainM1S3.dcf

If this runs successfuly, you're set!