DEV Community

Cover image for How I Built My Own AI Voice Assistant — “Nova”
Sarthak Wakade
Sarthak Wakade

Posted on

How I Built My Own AI Voice Assistant — “Nova”

A fun learning project inspired by Iron Man

Ever since I watched Iron Man, I dreamed of having my own AI voice assistant — something like Jarvis that could respond to me, talk back, and perform tasks.

So instead of downloading one from the Play Store, I decided to build my own assistant as a fun Python learning project.

I named it “NOVA”, which means a bright new star.


Getting Started

I wanted Nova to handle small but fun tasks — things like:

  • Reading the latest news
  • Opening apps like Instagram or LinkedIn
  • Playing my favorite music

To do that, I used Python and a few useful libraries, along with the Gemini API for AI responses.


Libraries I Used

import speech_recognition as sr
import webbrowser
import pyttsx3
import musicLibrary
import requests
import google.generativeai as genai
import threading
Enter fullscreen mode Exit fullscreen mode

Here’s what each one does:

Library Purpose
speech_recognition Converts your voice into text (Speech → Text)
webbrowser Opens websites or apps directly from Python
pyttsx3 Converts text back into voice (Text → Speech)
musicLibrary A custom module to store and play songs
requests Fetches real-time data like news articles
google.generativeai Connects to Gemini API for AI responses
threading Runs multiple tasks at the same time

How the Code Works

One of the coolest parts was making Nova respond only when I said “NOVA” — just like Jarvis wakes up when Tony Stark calls.

Here’s a simplified version of that logic:

if __name__ == "__main__":
    speak("Initializing NOVA ...") 
    while True:
        r = sr.Recognizer()
        print("Recognizing ...")
        try:
            with sr.Microphone() as source:
                print("Listening for wake word ...")
                audio = r.listen(source, timeout=4, phrase_time_limit=3)

            word = r.recognize_google(audio)
            if "nova" in word.lower():
                speak("Yes Sir, how may I help you?")
                print("Yes Sir, how may I help you?")

                # Listen for the actual command
                with sr.Microphone() as source:
                    print("Nova Active...")
                    audio = r.listen(source)
                    command = r.recognize_google(audio)

                    processCommand(command)

        except Exception as e:
            print("Error: {0}".format(e))
Enter fullscreen mode Exit fullscreen mode

Explanation (in simple words)

  • The program first says “Initializing NOVA…” — to let you know it’s ready.
  • It keeps listening for your wake word → “Nova”
  • Once it hears it, Nova replies:

“Yes Sir, how may I help you?”

  • Then it listens for your actual command — like: Play music Open Instagram
  • Those commands are then processed using processCommand()
  • Any errors are handled so the program doesn’t crash

Challenges & Mistakes (and What I Learned)

This project was full of learning moments!

Problem What Happened Solution
Gemini API not working Wrong model name and expired key Reconfigured and generated a new API key
No voice response Forgot engine = pyttsx3.init() Added engine initialization
Wake word not detected “Nova” wasn’t recognized clearly Adjusted timeout & phrase_time_limit
Continuous news reading It kept reading all articles endlessly Limited to top 5
Unhandled errors App crashed on bad input Added polite fallback responses

And yes — ChatGPT helped me debug a few issues faster!


The Best Part

After countless test runs, hearing:

“Initializing NOVA…”

from my laptop for the first time was an unforgettable feeling.

It felt like I had built my own mini Jarvis — one that could talk, listen, and perform real tasks.

This project taught me about:

  1. APIs
  2. Speech recognition
  3. Threading
  4. Real debugging
  5. Patience while coding!

Final Thoughts

If you’re learning Python or AI
I highly recommend trying a voice assistant project.

It’s simple to start, super fun to build,
and you’ll learn a LOT in the process.

Keep building cool stuff —
your own Nova might be the first step toward your next big AI idea.


Written by Sarthak Wakade — a creative developer exploring AI, frontend, and fun projects.

© 2025 Sarthak Wakade — All opinions are my own.


Enter fullscreen mode Exit fullscreen mode

Top comments (0)