VoiceCommandLab
From spoken commands to your application

VoiceCommandLab grew out of a practical need.
I wanted to say “forward,” “stop,” or “rest” and have an instrument or robot recognize the command.
VoiceCommandLab lets you define the vocabulary, record examples, and train the model.
VoiceCommandLib, its companion C++14 library, brings the resulting recognizer into your own application.
My first prototype used Whisper with a voice activity detector (VAD) I had written in Qt.
In my tests, music and background noise made it difficult to tell where a word began and ended.
An instrument that plays sounds or gives spoken feedback adds another complication: the microphone picks up its own loudspeaker.
One option was to develop a microphone array with audio playback synchronized to capture.
I chose to focus on the original goal: using a single microphone input to recognize one command at a time from a vocabulary chosen by the user.
Training the model
Start with the words your application actually needs.
Record several examples of each command, varying your pronunciation, your distance from the microphone, and the room conditions.
Include examples of unrelated words and background noise as well.
For a robot, recognizing “forward” matters just as much as staying still when someone says something that sounds like it.
VoiceCommandLab uses these labeled recordings to train a convolutional neural network through supervised learning.
During guided testing, you can listen to a sample, check the prediction, and correct a mistake.
If the model hears “back” as “forward,” you can label the recording correctly and add it to the training set.
The correction takes effect the next time you train.
Validation and test sessions stay separate, so you can check whether recognition also improves on fresh recordings.
The Model Report helps you see which commands the network still tends to confuse.
From the lab to your application
When the model is ready, you export a single .vcm file containing the trained weights, vocabulary, and parameters the library needs.
VoiceCommandLib implements the network architecture.
Your application loads the file, passes 16-bit mono PCM audio at 16 kHz to the library, and receives an event when the recognizer accepts a command. Recognition runs locally, and the C++14 library can be integrated without Qt or Python dependencies.
The download includes the Visual Studio 2019 x64 project, library tests, and a small demo for trying a model with a microphone.
For continuous listening, I recommend starting with the demo.
It shows how to feed audio blocks to the built-in detector, which estimates the background level and retains a short stretch of audio before and after each word.
Those margins matter.
If capture clips the first syllable or cuts off the last one, even a well-trained command can be difficult to recognize.
It should be noted that the microphone used for the recordings and the subsequent training is particularly effective if that same microphone is also used in the final application. The same principle applies to the voice used for the training, which will statistically always be more effective than other voices.
If you like this application and want to contribute to its development and improvement you can make a donation .... Thanks!
VoiceCommandLab nasce da un’esigenza concreta: poter dire «avanti», «stop» o «a riposo» e far riconoscere quel comando a uno strumento o a un robot.
Con VoiceCommandLab si definisce il vocabolario, si raccolgono gli esempi e si addestra il modello.
Con VoiceCommandLib, la libreria C++14 che accompagna il progetto, si porta il riconoscimento vocale nell’applicazione finale.
Il mio primo prototipo utilizzava Whisper insieme a un rilevatore di attività vocale (Voice Activity Detection, VAD) che avevo scritto in Qt.
Nelle mie prove, la musica e il rumore ambientale rendevano difficile stabilire dove iniziasse e finisse una parola.
Quando lo strumento stesso emette suoni o risposte vocali, anche l’altoparlante rientra nel segnale del microfono.
Una strada possibile era progettare un sistema a più microfoni, con la riproduzione audio sincronizzata all’acquisizione.
Ho scelto di concentrare il lavoro sull’obiettivo iniziale: riconoscere, con un solo ingresso microfonico, un comando alla volta da un vocabolario definito dall’utente.
Come si addestra il modello
Si parte dalle parole che servono davvero all’applicazione.
Per ogni comando si registrano più esempi, variando pronuncia, distanza dal microfono e condizioni della stanza.
Al vocabolario si affiancano esempi di altre parole e di rumore di fondo.
Per un robot, riconoscere «avanti» è importante quanto restare fermo quando qualcuno pronuncia una parola simile.
VoiceCommandLab usa queste registrazioni per addestrare una rete neurale convoluzionale con apprendimento supervisionato.
Il test guidato permette poi di ascoltare un campione, controllare la risposta e correggere un errore.
Se «indietro» viene interpretato come «avanti», si assegna alla registrazione l’etichetta corretta e la si aggiunge ai dati di addestramento.
La correzione entra nel modello al successivo addestramento.
Le sessioni di validazione e di test restano separate, così si può verificare se il riconoscimento migliora anche su registrazioni nuove.
Il Model Report aiuta a individuare quali comandi la rete tende ancora a confondere.
Dal laboratorio all’applicazione
Al termine si esporta un unico file .vcm, che contiene i pesi addestrati, il vocabolario e i parametri necessari alla libreria.
L’architettura della rete è implementata in VoiceCommandLib.
L’applicazione carica il file, passa alla libreria i campioni audio in formato PCM a 16 bit, mono, a 16 kHz e riceve un evento quando un comando viene accettato. Il riconoscimento avviene localmente e la libreria C++14 può essere integrata senza dipendenze da Qt o Python.
Il materiale allegato comprende il progetto per Visual Studio 2019 x64, i test della libreria e una piccola demo con cui provare un modello al microfono.
Per integrare l’ascolto continuo, consiglio di partire dalla demo.
L’esempio mostra come inviare i blocchi audio al rilevatore integrato, che stima il livello di fondo e conserva un breve tratto di segnale prima e dopo la parola.
È un dettaglio importante: se l’acquisizione taglia la prima sillaba o termina prima dell’ultima, anche una parola ben rappresentata nel vocabolario può diventare difficile da riconoscere.
Si evidenzia che il microfono con cui sono state fatte le registrazioni ed il conseguente training sono particolarmente efficaci se poi il microfono e' lo stesso utilizzato sull'applicazione finale. Le stesse problematiche si applicano alla voce usata per il training che statisticamente sara' sempre piu' efficace rispetto ad altre.
Se questa applicazione é di tuo gradimento e vuoi contribuire al suo sviluppo e miglioramento puoi fare una donazione .... Grazie!
The complete program with its installer : Tested on Win 10 x64
System libraries you may need ....
Revision History:
- 1.1.1 2026/12/01 : First release