ahmedbadr-dev/voice-ai-assistant
À propos
Python voice AI assistant: microphone STT, Google Gemini answers, offline TTS with pyttsx3. Clean env-based setup.
IA et apprentissage automatiqueWhat you can do
- Speech-to-text via Google Speech Recognition (default locale: Egyptian Arabic ar-EG)
- LLM answers powered by Google Gemini
- Text-to-speech replies with pyttsx3 (system voices)
- Exit phrases in Arabic / English (وداعاً, خروج, bye, exit, …)
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalVoice AI Assistant
A small Python voice assistant that listens through your microphone, sends your speech to Google Gemini, and speaks the reply back using offline TTS (pyttsx3).
Built as a focused demo of speech recognition + generative AI + text-to-speech on Windows.
Features
- Speech-to-text via Google Speech Recognition (default locale: Egyptian Arabic
ar-EG) - LLM answers powered by Google Gemini
- Text-to-speech replies with
pyttsx3(system voices) - Exit phrases in Arabic / English (
وداعاً,خروج,bye,exit, …) - Config via
.env— no API keys in source code
Project layout
AI_Assistant_Project/
├── assistant.py # Main voice loop
├── test_tts.py # Optional TTS smoke test
├── requirements.txt
├── .env.example
└── README.md
Requirements
- Python 3.11+ recommended
- Working microphone
- Windows: a system voice pack (Arabic voice optional for nicer Arabic TTS)
- Gemini API key from Google AI Studio
Setup
cd AI_Assistant_Project
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
# source .venv/bin/activate
pip install -r requirements.txt
copy .env.example .env # Windows
# cp .env.example .env # macOS / Linux
Edit .env and set:
GOOGLE_API_KEY=your_key_here
PyAudio on Windows
If pip install PyAudio fails, install a matching wheel for your Python version, or use:
pip install pipwin
pipwin install pyaudio
Run
python assistant.py
Speak after “Listening…”. Say goodbye / خروج / وداعاً to stop.
Optional TTS check:
python test_tts.py
Configuration
| Variable | Default | Description |
|---|---|---|
GOOGLE_API_KEY |
— | Required Gemini API key |
GEMINI_MODEL |
gemini-2.0-flash |
Model id |
LISTEN_LANGUAGE |
ar-EG |
Speech recognition locale |
TTS_RATE |
160 |
Words-per-minute for pyttsx3 |
How it works
- Capture microphone audio (
SpeechRecognition+PyAudio) - Transcribe with Google Speech API
- Send text prompt to Gemini
- Speak the model’s reply with
pyttsx3
Security notes
- Never commit
.envor hard-code API keys - If a key was ever pasted into source, rotate it in Google AI Studio
Author
Portfolio / learning project — voice interface around Google Gemini.
License
MIT
Explorer des projets similaires
Chargement…