A Python-based voice assistant inspired by Iron Man's Jarvis. It listens for a wake word, processes your voice commands, and can play music, read the latest news, open websites, and answer any question using Google's Gemini AI.
- 🎙️ Wake Word Detection — Always listening for
"Jarvis"to activate - 🌐 Website Launcher — Opens Google, YouTube, Facebook, Instagram on command
- 🎵 Music Playback — Plays songs from your personal music library via the browser
- 📰 News Reader — Reads out top headlines (Global, Pakistan, or BBC) using NewsAPI
- 🤖 AI Responses — Answers any general query using Google Gemini 2.5 Flash
- 🔊 Text-to-Speech — Speaks responses using Google TTS (
gTTS) + Pygame audio playback - 💤 Sleep Command — Say
"sleep now"to shut down Jarvis gracefully
| Component | Library/Service |
|---|---|
| Speech Recognition | SpeechRecognition + Google Speech API |
| Text-to-Speech | gTTS (Google Text-to-Speech) |
| Audio Playback | pygame |
| AI Engine | Google Gemini 2.5 Flash via google-genai |
| News | NewsAPI |
| Fallback TTS | pyttsx3 |
jarvis/
│
├── main.py # Main assistant logic
├── musicLibrary.py # Dictionary of song names mapped to URLs
├── requirements.txt # Python dependencies
└── README.md
git clone https://github.com/your-username/jarvis-voice-assistant.git
cd jarvis-voice-assistantpip install -r requirements.txtOpen main.py and replace the placeholders with your actual keys:
newsapi = "YOUR_NEWSAPI_KEY"
gemini_key = "YOUR_GEMINI_API_KEY"- Get a free NewsAPI key at newsapi.org
- Get a Gemini API key at aistudio.google.com
Edit musicLibrary.py to add your songs:
music = {
"believer": "https://www.youtube.com/watch?v=...",
"shape of you": "https://www.youtube.com/watch?v=...",
}python main.py| Command | Action |
|---|---|
"Jarvis" |
Wake up the assistant |
"Open Google" |
Opens google.com |
"Open YouTube" |
Opens youtube.com |
"Open Facebook" |
Opens facebook.com |
"Open Instagram" |
Opens instagram.com |
"Play [song name]" |
Plays the song from your music library |
"News" |
Reads BBC top headlines |
"Pakistan news" |
Reads top headlines from Pakistan |
"Global news" |
Reads latest global news |
"Sleep now" |
Shuts down Jarvis |
| Any other query | Answered by Gemini AI |
Create a requirements.txt with the following:
SpeechRecognition
pyttsx3
gTTS
pygame
requests
google-genai
pyaudio
Note:
pyaudiomay require additional setup on Windows. Install it via:pip install pipwin pipwin install pyaudio
- Add more website shortcuts
- Expand the music library
- Add smart home device control
- Integrate calendar/reminder functionality
- Build a GUI interface
This project is open source and available under the MIT License.
Built with 🤍 using Python, Google Gemini, and gTTS.