Building a speech recognizer
We need a database of speech files to build our speech recognizer. We will use the database available at https://code.google.com/archive/p/hmm-speech-recognition/downloads. This contains seven different words, where each word has 15 audio files associated with it. This is a small dataset, but this is sufficient to understand how to build a speech recognizer that can recognize seven different words. We need to build an HMM model for each class. When we want to identify the word in a new input file, we need to run all the models on this file and pick the one with the best score. We will use the HMM class that we built in the previous recipe.
How to do it…
Create a new Python file, and import the following packages:
import os import argparse import numpy as np from scipy.io import wavfile from hmmlearn import hmm from features import mfcc
Define a function to parse the input arguments in the command line:
# Function to parse input arguments def build_arg_parser()...