Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎙️ Algorithmic Voice Detection & Adaptive Recorder (No AI / Pure DSP)

Language DSP License

A high-precision, low-latency Voice Activity Detection (VAD) and automated audio recording engine built entirely on Digital Signal Processing (DSP) principles without external machine learning, cloud dependencies, or neural network overhead.


🔬 Mathematical Theory & Signal Processing Pipeline

[Raw Audio Stream] (16kHz, 16-bit PCM)
        │
        ▼
[30ms Window Partitioning] (480 samples/frame)
        │
        ▼
[Fast Fourier Transform (FFT)] ──► Real-to-Complex Frequency Domain (np.fft.rfft)
        │
        ▼
[Bandpass Masking] ──────────────► Zero-out frequencies < 300Hz and > 3400Hz (Vocal Tract)
        │
        ▼
[Inverse FFT (np.fft.irfft)] ────► Cleaned time-domain acoustic waveform
        │
        ▼
[RMS Energy Calculation] ────────► E_rms = sqrt( (1/N) * sum( x[i]^2 ) )
        │
        ▼
[Adaptive Silence Decision Engine] ─► Stops recording after trailing silence threshold

Why Algorithmic DSP over Deep Learning?

  • Zero Latency: Operates in real-time per 30ms window with sub-millisecond execution overhead.
  • Minimal Footprint: No PyTorch, TensorFlow, or ONNX runtimes. Consumes less than 25MB RAM.
  • Bandpass Isolation: Suppresses low-frequency mechanical rumble (< 300Hz) and high-frequency hiss (> 3400Hz), isolating the fundamental formants of human speech.
  • Dynamic Ambient Calibration: Automatically measures background acoustic levels on startup to adapt the speech threshold.

🚀 Quick Start

1. Installation

git clone https://github.com/Gaoc3/VoiceDetection.git
cd VoiceDetection
pip install -r requirements.txt

2. Usage

Command Line Interface (CLI):

python voice_detector.py --output my_recording.wav --silence 2.0

As a Python Module:

from voice_detector import AcousticVoiceDetector

detector = AcousticVoiceDetector(
    sample_rate=16000,
    silence_sec=2.3
)

# Automatically calibrates noise and records until silence
detector.record_until_silence("meeting_note.wav")

⚙️ Configurable Parameters

Parameter Type Default Description
sample_rate int 16000 Audio sampling rate in Hertz.
frame_ms int 30 Analysis window chunk size in milliseconds.
low_cutoff_hz float 300.0 Lower bandpass frequency bound (human voice band).
high_cutoff_hz float 3400.0 Upper bandpass frequency bound.
silence_sec float 2.3 Trailing silence duration before stopping recording.
rms_threshold float 500.0 Base speech sensitivity threshold (dynamically calibrated).

👨‍💻 Author

  • Hussain Ibrahim Ahmed (Gaoc3)
    Systems & Backend Software Engineer | Distributed Infrastructure
    LinkedInGitHub

About

Algorithmic real-time acoustic voice detection and speaker identification pipeline in pure Python using Digital Signal Processing (DSP).

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages