Skip to content
プロジェクト

概要

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

AI・機械学習

この数値の測り方

できること

  • 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時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

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.

Python Gemini License


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

  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

関連プロジェクトを探す

読み込み中…