Real-time Voice Isolation and Ambient Mode Trigger System
EchoShield is a clean, focused AI project that provides real-time voice filtering and ambient mode triggering for Galaxy Buds 3 Pro. It isolates your voice while suppressing all other sounds, and automatically switches to ambient mode when wake words are detected.
The Core Problem: When wearing noise-cancelling headphones, you can't hear your surroundings or other people talking to you. EchoShield solves this by:
- 🎤 Voice Isolation: Only lets YOUR voice pass through to your headphones
- 🔇 Noise Filtering: Blocks out background noise and other people's voices
- 🌊 Ambient Mode: When someone says your wake word (like "Thayaa"), it automatically switches Galaxy Buds to ambient mode for 10 seconds
Real-world Example: You're working with Galaxy Buds 3 Pro, someone says "Thayaa, excuse me" → EchoShield detects this, switches to ambient mode, and you can hear them clearly.
Quick Test (Basic Voice Filtering):
python run_simple.pyFull EchoShield Core (Recommended):
# Option 1: Record your voice sample live
python record_voice_sample.py
# Option 2: Upload a clean audio file (better quality)
python voice_upload.py your_voice_file.wav
# Then run EchoShield Core
python echoshield_core.pyTest Normal Recording (Compare with EchoShield):
python test_normal_recording.pyThat's it! EchoShield Core will isolate your voice and trigger ambient mode on wake words.
- Voice Activity Detection: Uses WebRTC VAD to detect speech
- Voice Identification: Uses Resemblyzer to identify and allow only your voice
- Noise Reduction: Applies noise reduction using noisereduce library
- Real-time Processing: Low-latency audio processing with sounddevice
- Wake Word Detection: Uses Vosk for real-time speech recognition
- Customizable Wake Words: Set your own wake words like "Thayaa", "Excuse me"
- Visual & Audio Feedback: Chime sounds and visual notifications
- Parallel Processing: Voice filtering and wake word detection run simultaneously
# Clone the repository
git clone <your-repo-url>
cd EchoShield
# Install dependencies
pip install -r requirements.txt# Run the installation test to make sure everything works
python test_installation.py# Try the simple version first - just basic speech detection
python run_simple.pyThis will:
- ✅ Detect when you're speaking
- ✅ Pass your voice through to headphones
- ✅ Block silence and background noise
- ❌ No voice identification (allows all speech)
- ❌ No wake word detection
# Create voice sample recording script
python main.py --create-voice-sample
# Record your voice (5 seconds)
python record_voice_sample.py# Basic usage (voice filtering only)
python main.py
# With voice sample for voice identification
python main.py --voice-sample audio_samples/my_voice.wav
# With wake word detection (requires Vosk model)
python main.py --vosk-model vosk-model-small-en-us-0.15
# Custom wake words
python main.py --wake-words "thayaa" "excuse me" "hey echo"# Download a small English model (50MB)
wget https://alphacephei.com/vosk/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zippython main.py [OPTIONS]
Options:
--voice-sample PATH Path to your voice sample file (.wav)
--vosk-model PATH Path to Vosk model directory
--wake-words WORDS Wake words to detect (default: thayaa, excuse me, hey echo)
--no-noise-reduction Disable noise reduction
--no-wake-word Disable wake word detection
--create-voice-sample Create voice sample recording scriptEchoShield/
├── main.py # Main application entry point
├── voice_filter/
│ ├── mic_stream.py # Audio stream handling
│ └── vad_filter.py # Voice activity detection & identification
├── wake_word/
│ └── detector.py # Wake word detection & ambient mode
├── utils/
│ └── audio_tools.py # Audio utility functions
├── audio_samples/ # Voice samples directory
└── requirements.txt # Python dependencies
- 🎤 Input: Captures microphone audio in real-time
- 🔍 Speech Detection: Uses WebRTC VAD to detect when someone is speaking
- 🧠 Voice Identification: Uses Resemblyzer to check if it's YOUR voice
- 🔇 Noise Reduction: Cleans up background noise (optional)
- 📢 Output: Sends filtered audio to your headphones
- 📝 Speech Recognition: Uses Vosk to convert speech to text
- 🎯 Pattern Matching: Looks for your wake words ("Thayaa", "Excuse me")
- 🌊 Ambient Trigger: When detected, temporarily allows all audio through
- ⏰ Auto-Reset: Returns to voice filtering after 5 seconds
run_simple.py - Lightweight version:
- ✅ Basic speech detection only
- ✅ No CPU-intensive processing
- ✅ Perfect for testing and low-power devices
main.py - Full version:
- ✅ Voice identification (only YOUR voice passes through)
- ✅ Noise reduction
- ✅ Wake word detection (with Vosk model)
⚠️ Requires more CPU power
- Increased Frame Size: 30ms → 60ms (reduces CPU load)
- Simplified Processing: Disabled heavy noise reduction by default
- Reduced Wake Word Frequency: Process every 3 seconds instead of 2
- Filtered Status Messages: Only show important errors, not overflow warnings
- Similarity Threshold: 0.7 (adjustable in
vad_filter.py) - Buffer Size: 2 seconds for voice identification
- Sample Rate: 16kHz (required for WebRTC VAD)
- Buffer Size: 5 seconds for speech recognition
- Processing: 2-second chunks for real-time performance
- Model: Vosk small English model (50MB)
-
"Input overflow" errors ✅ FIXED
- Problem: Audio processing was too intensive
- Solution: Optimized audio pipeline and simplified processing
- Use:
python run_simple.pyfor lightweight version
-
WebRTC VAD errors ✅ FIXED
- Problem: "Error while processing frame" from WebRTC VAD
- Solution: Fixed frame size compatibility and added error handling
- Use: All versions now work with proper frame sizes
-
High CPU usage ✅ FIXED
- Problem: Too much real-time processing
- Solution: Optimized audio pipeline and reduced processing frequency
- Use:
python main.py --no-noise-reductionto disable heavy processing
-
Wake word detection not working
- Problem: No Vosk model or processing overload
- Solution: Download Vosk model and use optimized settings
- Use:
python main.py --vosk-model vosk-model-small-en-us-0.15
-
Voice identification not working
- Problem: No voice sample or poor quality
- Solution: Record clear 5+ second voice sample
- Use:
python record_voice_sample.pythenpython main.py --voice-sample audio_samples/my_voice.wav
If you experience problems:
- Start with simple mode:
python run_simple.py - Disable heavy features:
python main.py --no-noise-reduction --no-wake-word - Use larger frames: The system automatically uses 60ms frames for stability
# If you get import errors
pip install --upgrade -r requirements.txt
# For macOS audio issues
brew install portaudio
# Test everything works
python test_installation.py| Mode | Speech Detection | Voice ID | Wake Words | Galaxy Buds | Recording |
|---|---|---|---|---|---|
run_simple.py |
✅ | ❌ | ❌ | ❌ | ❌ |
main.py |
✅ | ✅ | ❌ | ❌ | ❌ |
echoshield_core.py |
✅ | ✅ | ✅ | ✅ | ✅ |
test_normal_recording.py |
❌ | ❌ | ❌ | ❌ | ✅ |
voice_upload.py |
❌ | ❌ | ❌ | ❌ | ❌ |
Option 1: Live Recording
python record_voice_sample.pyOption 2: Upload Clean Audio File (Recommended)
# Upload any audio file (WAV, MP3, M4A, FLAC, OGG)
python voice_upload.py your_voice_file.wav
# List available voice files
python voice_upload.py --list
# Validate a voice file
python voice_upload.py --validate your_voice_file.wavBenefits of Upload:
- ✅ Higher quality (no background noise)
- ✅ Multiple formats supported
- ✅ Automatic conversion to 16kHz
- ✅ Quality validation
- ✅ Better voice identification accuracy
EchoShield Core integrates with your Galaxy Buds 3 Pro to automatically switch between modes:
- Normal Mode: Noise cancellation active, only your voice passes through
- Wake Word Detected: Automatically switches to ambient mode
- Ambient Mode: You can hear surroundings clearly (like Galaxy Buds' siren detection)
- Auto-Return: Returns to noise cancellation after 10 seconds
- "Thayaa"
- "Excuse me"
- "Hey echo"
- Automatically starts recording when wake word detected
- Saves audio recordings for testing and analysis
- Timestamped files in
recordings/directory - Compare with
test_normal_recording.pyto see the difference
- Whisper integration for better accuracy
- Custom chime sounds
- GUI interface
- Multiple voice profiles
- Real-time audio visualization
- Mobile app integration
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please open an issue on GitHub.
Built with ❤️ for personal AI projects