DeveloperBreeze

Text-To-Speech Development Tutorials, Guides & Insights

Unlock 1+ expert-curated text-to-speech tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your text-to-speech skills on DeveloperBreeze.

Build a Voice-Controlled AI Assistant with Python

Tutorial December 10, 2024
python

Set up speech recognition to capture voice commands using your microphone.

import speech_recognition as sr

def listen_command():
    recognizer = sr.Recognizer()
    with sr.Microphone() as source:
        print("Listening...")
        try:
            audio = recognizer.listen(source)
            command = recognizer.recognize_google(audio)
            print(f"You said: {command}")
            return command.lower()
        except sr.UnknownValueError:
            print("Sorry, I didn't catch that.")
            return None