📈 GH Trending Explorer 🎲 Surprise me

← all repos

ahmedbadr-dev / voice-ai-assistant

git clone https://github.com/ahmedbadr-dev/voice-ai-assistant.git

Python voice AI assistant: microphone STT, Google Gemini answers, offline TTS with pyttsx3. Clean env-based setup.

—
stars, 24h
+28
stars, 7 days · #1,376
+28
stars, 30 days · #9,266
28
★ total · +28% this week
0
forks · 0 open issues

Star history starts 2026-10-20; the chart appears after the second daily snapshot.

LanguagePython
LicenseMIT
Created2026-10-15 (5d ago)
Last push4d ago
Watchers0
OwnerUser

GitHub topics

Links

README excerpt
# 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
 [code] 
---
## 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
 [code] 
Edit `.env` and set:
 [code] 
### PyAudio on Windows
If `pip install PyAudio` fails, install a matching wheel for your Python version, or use:
 [code] 
---
## Run
 [code] 
Speak after “Listening…”. Say **goodbye** / **خروج** / **وداعاً** to stop.
Optional TTS check:
 [code] 
---
## 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
1. Capture microphone audio (`SpeechRecognition` + `PyAudio`) 
2. Transcribe with Google Speech API 
3. Send text prompt to Gemini 
4. Speak the model’s reply with `pyttsx3` 
---
## Security notes
- Never commit `.env` or 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