Skip to content

The Voice Recognition Project is a Java-based application designed to process and interpret human speech. Using advanced speech-to-text algorithms, the system captures audio input, translates spoken words into text, and performs predefined actions or responses.

License

Notifications You must be signed in to change notification settings

amnatariq290/Java-Voice-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ—£οΈ Java Voice Command Recognition with Sphinx4

This project is a simple Java-based voice command recognition application using the CMU Sphinx4 library. It listens to your microphone input and detects predefined voice commands using a grammar-based approach (JSGF).


πŸš€ Features

  • πŸŽ™οΈ Real-time voice command recognition
  • πŸ“– Grammar-based recognition using .jsgf
  • πŸ’» Works offline, no internet needed
  • πŸ”§ Easily extensible with new commands

🧰 Requirements

  • Java JDK 8 or higher
  • Eclipse / IntelliJ / NetBeans or any Java IDE
  • Sphinx4 JAR files
  • Microphone

πŸ“ Project Structure

SpeechRecognitionProject/ β”œβ”€β”€ src/ β”‚ └── SpeechRecognitionExample.java β”œβ”€β”€ resources/ β”‚ β”œβ”€β”€ grammar/ β”‚ β”‚ └── commands.jsgf β”‚ └── dictionary.dict β”œβ”€β”€ lib/ β”‚ └── (Sphinx4 JAR files) β”œβ”€β”€ README.md


πŸ“¦ JAR Files Needed

Place these JAR files inside the lib/ folder (download from the Sphinx4 GitHub repo):

  • sphinx4-core.jar
  • sphinx4-data.jar
  • sphinx4-common.jar
  • sphinx4-util.jar
  • sphinx4-signal.jar
  • jsapi.jar

πŸ”§ Setup Instructions

  1. Clone or Download the Project
git clone https://github.com/amnatariq290/speech-recognition-java.git
cd speech-recognition-java

Open in your IDE
Import the project and add all JARs in the lib/ folder to your project's build path.

Set Resource Paths in Code

In SpeechRecognitionExample.java, make sure to configure these paths:
configuration.setAcousticModelPath("file:resources/acoustic-model");
configuration.setDictionaryPath("file:resources/dictionary.dict");
configuration.setGrammarPath("file:resources/grammar");
configuration.setGrammarName("commands");
configuration.setUseGrammar(true);

4.Run the Program
Click Run in your IDE

Speak into the microphone using one of the defined commands
It will print the recognized command.

Command File:commands.jsgf
#JSGF V1.0;
grammar commands;
public <command> = and | the | none | boo | mm | hm | and with | no | how | who | what | it happened ;
You can modify this file to add or remove commands easily.

πŸ’‘ Tips
Speak clearly and close to the mic

You can add more words in commands.jsgf and handle them in the Java code

Check your dictionary file (dictionary.dict) has phonemes for every word in grammar

πŸ‘©β€πŸ’» Author
Amna Tariq

About

The Voice Recognition Project is a Java-based application designed to process and interpret human speech. Using advanced speech-to-text algorithms, the system captures audio input, translates spoken words into text, and performs predefined actions or responses.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published