This project implements an Audio Command Recognition System using MATLAB and deep learning. The system records an audio command, processes it, and classifies it into predefined categories. It uses a trained neural network model to make predictions and displays the predicted class with its probability.
- Audio Command Recognition: Recognizes voice commands from recorded audio.
- Real-time Recording: Records audio through the microphone.
- Live Playback: Plays back the recorded audio after it is captured.
- Prediction: Classifies the audio command using a deep learning model.
- Display of Prediction: Shows the predicted command and the corresponding probability.
Before running the project, ensure you have the following:
- MATLAB (Version 2019 or later)
- Deep Learning Toolbox (for training and using neural networks)
- Audio Toolbox (for audio processing)
- Pretrained Neural Network Model (Trained model file for classification)
- Support Packages (for microphone access, sound playback, etc.)
-
Clone this repository:
git clone https://github.com/yourusername/audio-command-recognition.git
-
Install required packages: Make sure you have the necessary MATLAB toolboxes installed (e.g., Deep Learning Toolbox, Audio Toolbox). You can install them using the MATLAB Add-On Explorer.
-
Prepare the trained model:
- The neural network model for classification should be trained using a dataset of audio commands.
- Place the trained model file (
trainedNet.mat
or equivalent) in the project directory.
-
Preprocessing audio data:
- The audio data should be recorded with a consistent sample rate and duration.
- Audio preprocessing (such as feature extraction, normalization, etc.) should be handled before passing the data into the trained network.
-
Run the main script: The script
audio_command_recognition.m
handles the full process of recording, processing, and classifying the audio command.- The system will record a 2-second audio sample.
- It will then preprocess the audio and pass it to the trained neural network for classification.
- The predicted class with its probability will be displayed in the MATLAB console.
- The recorded audio will also be played back.
-
Testing the system: To test the system with your own audio commands, ensure that you have a trained model and modify the script as needed to match the input format.
Recording...
Recording complete.
Playing back recorded audio...
Predicted Command: 'TOL3'
Probability: 85.62%
Prediction Scores for All Classes:
L1: 5.23%
TOL2: 0.74%
TOL3: 85.62%
TOL4: 3.21%
TOFL1: 1.11%
TOFL2: 0.92%
TOFL3: 1.05%
TOFL4: 2.12%
To train your own model:
- Prepare a dataset of labeled audio commands.
- Extract features from the audio data (e.g., Mel-spectrogram, MFCCs).
- Train a neural network using
trainNetwork
with your data.
- This project uses MATLAB's Deep Learning Toolbox and Audio Toolbox.
- Thanks to the open-source community for the many resources and libraries available for audio processing and machine learning.
This project is open Sourced.
- Introduction: Describes what the project does.
- Features: Lists the main functionalities of the system.
- Prerequisites: Specifies the necessary tools and libraries.
- Setup: Instructions on how to clone the repository and set up the environment.
- Usage: How to run the system and what the user can expect as output.
- Model Training: Provides a brief on how to train the model if needed.
- Acknowledgments: Credits to tools and resources used.
- License: Licensing info (optional, you can adjust based on your needs).