A speech recognition system that responds to voice commands for different rooms using PocketSphinx.
This project implements a simple voice command system that can recognize room names (Living Room, Kitchen, Bedroom) and an exit command. When a command is recognized, the system responds with a text-to-speech confirmation using Flite.
The project requires the following dependencies:
- Python 3.x
- PocketSphinx 5.0.4
- PyAudio 0.2.14
- Flite (speech synthesis)
All Python dependencies are listed in the requirements.txt
file.
voice_command.py
: Main application that listens for voice commandslist_audio_devices.py
: Utility to list available audio input devicesroom_commands.jsgf
: Grammar file defining the commandsroom_vocabulary.dic
: Dictionary file with phonetic pronunciationsrequirements.txt
: Python dependencies
-
Install required packages:
pip install -r requirements.txt
-
Install Flite text-to-speech engine:
- On Ubuntu/Debian:
sudo apt-get install flite
- On other systems: refer to Flite documentation
- On Ubuntu/Debian:
-
Ensure PocketSphinx acoustic models are installed (usually at
/usr/share/pocketsphinx/model/en-us
) -
Run the
list_audio_devices.py
script to identify your microphone:python list_audio_devices.py
-
Update the
mic_device_index
invoice_command.py
(line 179) with your microphone's index number
Execute the main script:
python voice_command.py
Once running, you can say any of the following commands:
- "Living Room"
- "Kitchen"
- "Bedroom"
- "Exit" (terminates the program)
- If you receive errors about audio devices, run
list_audio_devices.py
to check available devices - Ensure the paths in the configuration section of
voice_command.py
match your system - If speech recognition is poor, you may need to adjust the microphone settings or improve acoustic conditions
- The system loads a grammar file that defines the commands it can recognize
- Audio is captured from the microphone in real-time
- PocketSphinx processes the audio and attempts to match it against known commands
- When a command is recognized, a confirmation is spoken using Flite
- The system continues listening until "Exit" is spoken or Ctrl+C is pressed