The Palos Publishing Company

Follow Us On The X Platform @PalosPublishing
Categories We Write About

Create a Python voice reminder app

Here’s a Python script for a simple voice reminder app. It lets you:

  • Set a reminder time

  • Speak a reminder message

  • The app will notify you by speaking the reminder at the set time

It uses speech_recognition for voice input, pyttsx3 for text-to-speech, and datetime to track time.

python
import speech_recognition as sr import pyttsx3 import datetime import time # Initialize speech engine engine = pyttsx3.init() engine.setProperty('rate', 150) # Speech rate def speak(text): engine.say(text) engine.runAndWait() def listen(): r = sr.Recognizer() with sr.Microphone() as source: print("Listening...") audio = r.listen(source) try: text = r.recognize_google(audio) print(f"You said: {text}") return text.lower() except sr.UnknownValueError: print("Sorry, I didn't catch that.") return None except sr.RequestError: print("Could not request results.") return None def parse_time(reminder_time_str): try: # Parse time like "15:30" or "3:30 pm" reminder_time = datetime.datetime.strptime(reminder_time_str, "%H:%M").time() return reminder_time except ValueError: try: reminder_time = datetime.datetime.strptime(reminder_time_str, "%I:%M %p").time() return reminder_time except ValueError: return None def main(): speak("Please say the reminder time in 24-hour format, for example, 15:30.") reminder_time_str = None while not reminder_time_str: reminder_time_str = listen() if reminder_time_str: # Clean input: keep only digits, colon, am/pm if present reminder_time_str = reminder_time_str.replace(" ", "") reminder_time = parse_time(reminder_time_str) if not reminder_time: speak("Time format not recognized. Please say the time again.") reminder_time_str = None speak("Please say your reminder message.") reminder_message = None while not reminder_message: reminder_message = listen() if not reminder_message: speak("I didn't catch that, please repeat your reminder message.") speak(f"Reminder set for {reminder_time_str}. I will remind you to: {reminder_message}") while True: now = datetime.datetime.now() if now.time().hour == reminder_time.hour and now.time().minute == reminder_time.minute: speak(f"Reminder: {reminder_message}") break time.sleep(15) if __name__ == "__main__": main()

Requirements:

bash
pip install SpeechRecognition pyttsx3 pyaudio
  • On some systems, pyaudio is tricky to install. If on Windows, download the appropriate wheel from here.

  • Run the script in a quiet room with a good microphone.

Would you like me to help with a version that uses text input instead?

Share this Page your favorite way: Click any app below to share.

Enter your email below to join The Palos Publishing Company Email List

We respect your email privacy

Categories We Write About