ahmedbadr-dev/voice-ai-assistant
حول
Python voice AI assistant: microphone STT, Google Gemini answers, offline TTS with pyttsx3. Clean env-based setup.
الذكاء الاصطناعي وتعلّم الآلةما يمكنك فعله
- 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, …)
النمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- ٠
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلVoice 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
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…