Vocal-Agent
Vocal-Agent copied to clipboard
A sophisticated real-time voice assistant that seamlessly integrates speech recognition, AI reasoning, and neural text-to-speech synthesis. It is designed for natural conversational interactions with...
Vocal Agent - Real-Time Speech-to-Speech AI Assistant π€
A sophisticated real-time voice assistant that seamlessly integrates speech recognition, AI reasoning, and neural text-to-speech synthesis. Designed for natural conversational interactions with advanced tool-calling capabilities.
π How Vocal Agent Works
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VOCAL AGENT WORKFLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π€ USER SPEAKS
β
βΌ
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
β AUDIO CAPTURE β β VOICE ACTIVITY β β SPEECH-TO-TEXT β
β βββββΆβ DETECTION βββββΆβ β
β β’ Microphone Input β β β’ Silero VAD β β β’ Whisper large-v1 β
β β’ 16kHz Sampling β β β’ Real-time Monitor β β β’ Language: English β
β β’ Continuous Stream β β β’ Start/Stop Detect β β β’ CUDA Acceleration β
βββββββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ
β
βΌ
π "What's the weather in Tokyo?"
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β AI REASONING ENGINE β
β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
β β LLAMA 3.1 8B β β AGNO FRAMEWORK β β TOOL SELECTION β β
β β βββββΆβ βββββΆβ β β
β β β’ Via Ollama β β β’ Agent Orchestrationβ β β’ Google Search β β
β β β’ Local LLM β β β’ Context Management β β β’ Wikipedia β β
β β β’ 8B Parameters β β β’ Response Generationβ β β’ ArXiv Papers β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
π TOOL EXECUTION (if needed)
β
ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β GOOGLE SEARCH β β WIKIPEDIA β β ARXIV β
β β β β β β
β β’ Web Results β β β’ Encyclopedia β β β’ Research β
β β’ Real-time β β β’ Facts & Info β β β’ Papers β
β β’ Current Data β β β’ Historical β β β’ Academic β
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β β β
ββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββ
β
βΌ
π AGGREGATED INFORMATION
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RESPONSE GENERATION β
β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
β β TEXT RESPONSE β β TEXT PROCESSING β β PHONEME GEN β β
β β βββββΆβ βββββΆβ β β
β β β’ Natural Lang β β β’ G2P Conversion β β β’ Misaki Engine β β
β β β’ Conversationalβ β β’ eSpeak Fallback β β β’ English Phonemes β β
β β β’ 1-2 Sentences β β β’ British=False β β β’ Max Length: 500 β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NEURAL VOICE SYNTHESIS β
β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
β β KOKORO-82M β β VOICE PROFILES β β AUDIO OUTPUT β β
β β βββββΆβ βββββΆβ β β
β β β’ ONNX Model β β β’ af_heart (warm) β β β’ 16kHz Audio β β
β β β’ 82M Params β β β’ af_sky (clear) β β β’ Natural Speech β β
β β β’ High Quality β β β’ af_bella (dynamic) β β β’ Speed: 1.2x β β
β βββββββββββββββββββ ββββββββββββββββββββββββ βββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
π SPEAKER OUTPUT
β
βΌ
π USER HEARS RESPONSE
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β PERFORMANCE METRICS β
β β
β Speech Recognition: ~200-500ms β LLM Processing: ~1-3s β TTS: ~100-300ms β
β Total Latency: ~1.3-3.8s β Memory Usage: ~4-6GB β Concurrent: 2x β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β KEY FEATURES β
β β
β ποΈ Continuous Listening β π§ Smart Tool Selection β π£οΈ Natural Voice Output β
β β‘ Real-time Processing β π Web-Connected Intel β π§ Extensible Architecture β
β π― Voice Activity Detect β π Multi-source Search β βοΈ Configurable Settings β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Key Features
- ποΈ Real-time Speech Processing: Advanced speech recognition using Whisper large-v1 with Silero VAD for accurate voice activity detection
- π§ Intelligent Reasoning: Powered by Llama 3.1 8B through the Agno agent framework for sophisticated AI responses
- π Web-Connected Intelligence: Integrated web search capabilities (Google Search, Wikipedia, ArXiv) for up-to-date information
- π£οΈ Natural Voice Synthesis: High-quality speech generation using Kokoro-82M ONNX for human-like voice output
- β‘ Low-Latency Pipeline: Optimized audio processing for real-time conversational experience
- π§ Extensible Architecture: Modular tool system allowing easy integration of new capabilities
ποΈ Architecture Overview
| Component | Technology | Purpose |
|---|---|---|
| Speech Recognition | Whisper (large-v1) + Silero VAD | Convert speech to text with voice activity detection |
| Language Model | Llama 3.1 8B via Ollama | Natural language understanding and generation |
| Text-to-Speech | Kokoro-82M ONNX | Convert text responses to natural speech |
| Agent Framework | Agno LLM Agent | Tool orchestration and reasoning capabilities |
| Web Integration | Custom API connectors | Real-time information retrieval |
π Prerequisites
- Python: Version 3.9 or higher
- Ollama: Local LLM server (Installation Guide)
- System Audio: Microphone and speakers/headphones
- Operating System: macOS, Linux, or Windows
π Quick Start
1. Install Ollama
macOS:
# Download from https://ollama.com/download/mac
# Or install via Homebrew
brew install ollama
Linux:
curl -fsSL https://ollama.com/install.sh | sh
Windows:
# Download installer from https://ollama.com/download/windows
2. Clone and Setup
git clone https://github.com/danieladdisonorg/Vocal-Agent.git
cd Vocal-Agent
3. Install Dependencies
# Install Python dependencies
pip3 install -r requirements.txt
pip3 install --no-deps kokoro-onnx==0.4.7
4. Install System Dependencies
Linux:
sudo apt-get install espeak-ng
macOS:
brew install espeak-ng
Windows:
- Download eSpeak NG from releases page
- Install the
.msipackage (e.g.,espeak-ng-20191129-b702b03-x64.msi)
5. Download AI Models
Language Model:
ollama pull llama3.1:8b
Voice Models: Download the following files and place them in the project root directory:
π― Usage
Starting the Application
- Start Ollama service:
ollama serve
- Initialize the model (in a separate terminal):
ollama run llama3.1:8b
- Launch Vocal Agent:
python3 main.py
Interaction Flow
π€ Listening... Press Ctrl+C to exit
π΄ Speak now - Recording started
βΉοΈ Recording stopped
π Transcribed: "What's the weather like in Tokyo today?"
π§ LLM Tool calls...
π€ Response: "Let me check the current weather in Tokyo for you..."
π [Audio response plays]
βοΈ Configuration
Customize the application behavior by modifying settings in main.py:
# Audio Processing Configuration
SAMPLE_RATE = 16000 # Audio sample rate (Hz)
MAX_PHONEME_LENGTH = 500 # Maximum phoneme sequence length
# Voice Synthesis Settings
SPEED = 1.2 # Speech rate multiplier
VOICE_PROFILE = "af_heart" # Voice character selection
# Performance Settings
MAX_THREADS = 2 # Parallel processing threads
Available Voice Profiles
-
af_heart- Warm, friendly tone -
af_sky- Clear, professional tone -
af_bella- Expressive, dynamic tone - Additional profiles available in
voices-v1.0.bin
π Project Structure
Vocal-Agent/
βββ main.py # Core application entry point
βββ agent_client.py # LLM agent integration layer
βββ kokoro-v1.0.onnx # Neural TTS model
βββ voices-v1.0.bin # Voice profile database
βββ requirements.txt # Python dependencies
βββ vocal_agent_mac.sh # macOS setup automation script
βββ demo.png # Application demonstration
βββ LICENSE # MIT license
βββ README.md # Project documentation
π οΈ Development
Extending Functionality
Add new tools to the agent by integrating Agno Toolkits:
from agno import Agent
from agno.tools import WebSearchTool, WikipediaSearchTool
# Add custom tools
agent = Agent(
tools=[WebSearchTool(), WikipediaSearchTool(), YourCustomTool()],
model="llama3.1:8b"
)
Performance Optimization
- GPU Acceleration: Enable CUDA for faster model inference
- Model Selection: Choose smaller models for faster response times
- Audio Buffer Tuning: Adjust buffer sizes for your hardware
π§ Troubleshooting
Common Issues
Ollama Connection Error:
# Ensure Ollama is running
ollama serve
# Verify model is available
ollama list
Audio Device Issues:
- Check microphone permissions
- Verify audio device selection in system settings
- Test with
python3 -c "import sounddevice; print(sounddevice.query_devices())"
Model Download Failures:
- Ensure stable internet connection
- Verify sufficient disk space (models require ~8GB)
- Check Ollama service status
π Performance Metrics
- Speech Recognition Latency: ~200-500ms
- LLM Response Time: ~1-3 seconds (depending on query complexity)
- Text-to-Speech Generation: ~100-300ms
- Memory Usage: ~4-6GB (with Llama 3.1 8B)
π€ Contributing
We welcome contributions! Please see our contribution guidelines for details on:
- Code style and standards
- Testing requirements
- Pull request process
- Issue reporting
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Acknowledgments
- RealtimeSTT - Speech-to-text with VAD integration
- Kokoro-ONNX - Efficient neural text-to-speech
- Agno - Powerful agent framework
- Ollama - Local LLM serving platform
- Weebo - Project inspiration
π Support
- Documentation: Project Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions