To train (and evaluate) a classifier for fixed-vocabulary speech commands
you should build a curated dataset that:
- Has a well-defined list of commands (the classes for the classifier)
- Has enough samples of each command. 10-100, or more
- Each audio sample contains only one command.
- Each sample is roughly of same length
- Onset of the command is positioned at start of audio sample
The dataset would then be a collection of .WAV audio files, and a .CSV that describes them:
A basic process for the recording would be to use an existing audio program (such as Audacity),
and make one audio recording for each word.
One thing that may speed up the collection is to record many utterances in one go.
Say a single command word ("up") many times in a row, with a lot of silence (0.5sec) between each command. An automatic audio segmentation algorithm can then be used to split the commands using the silence.
Example programs for splitting on silence are: pyAudioAnalysis and audiotok
A good data collection process makes sure to contain
most of the naturally occuring variation in the classes.
For speech that usually means recording many different speakers,
as everyone tends to say things slightly differently.
But even with a single speaker you can introduce some variation yourself:
Do additional passes of recordings where you say the words either fast or slow.
And also passes where you say them loud (near shout), or soft (near whisper).
You may also want to have out-of-class examples, at least for evaluation.
You can collect these in the much the same way.
In order to get many different words, can for example read a Wikipedia article word-by-word (with silence between). And then go over and remove your target words.