Skip to content

xe-nvdk/voice-authentication-system-python

Repository files navigation

Voice Authentication System in Python

A simple voice-based authentication system built with Python. Record a voice password, train a machine learning model using MFCC features, and run real-time voice validation to grant or deny access.

Inspired by spy-movie-style biometric systems — but built entirely with open-source tools, running locally.


Features

  • Record your own voice password
  • Extract MFCC features with librosa
  • Train an SVM model using scikit-learn
  • Real-time voice authentication from mic input
  • Lightweight, local-only — no cloud APIs

How It Works

  1. Record audio samples of your password phrase (e.g., "access")
  2. Record negative samples (e.g., saying a different word like "banana")
  3. Extract features from the audio files using MFCC
  4. Train a classifier to distinguish between your voice and others
  5. Use the model to authenticate future voice input

Project Structure

auth-voice-system/
├── authenticate.py
├── extract_features.py
├── record_voice_password.py
├── train_model.py

Note: The voice samples, extracted features, and trained model are not included for privacy reasons. Run the scripts yourself to generate them.


Getting Started

1. Install Requirements

pip install sounddevice scipy librosa scikit-learn numpy joblib

2. Record Voice Samples

Record 20 samples of your password phrase:

python3 record_voice_password.py

Then change the phrase (e.g., to "banana") and record 10 negative samples into a different folder.

3. Extract MFCC Features

python3 extract_features.py

This generates a dataset from your recordings.

4. Train the Model

python3 train_model.py

This saves voice_auth_model.pkl.

5. Run Authentication

python3 authenticate.py

Speak your password — the system will predict if it's you and decide whether to grant access.


What You Can Build With This

  • Raspberry Pi door unlocker
  • Secure local script runner
  • Biometric voice login for private folders
  • Smart home voice toggle
  • Multispeaker verification system

What to Try Next

  • Use deep learning (e.g., CNNs or speechbrain) for better accuracy
  • Add a simple GUI with Streamlit or Flask
  • Hook it to real hardware using GPIO (e.g., Raspberry Pi relay)
  • Add noise filtering or augmentation for robustness
  • Detect spoofing attempts with audio playback detection

License

This project is open-sourced for educational purposes. Use responsibly. No biometric data is included in this repository.

About

A simple voice-based authentication system built with Python. Record a voice password, train a machine learning model using MFCC features, and run real-time voice validation to grant or deny access.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages