8000 voice controlled to do list added to utilities · d-coder111/SpectrumOfPython@96d3067 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96d3067

Browse files
committed
voice controlled to do list added to utilities
1 parent 27d84ea commit 96d3067

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
VOICE-CONTROLLED TO-DO LIST
2+
3+
4+
Description
5+
Voice-Controlled To-Do List is a Python-based desktop application that allows users to manage their tasks using both typed input and voice commands. It leverages the Tkinter library for the GUI and SpeechRecognition to accept voice input. Users can add, view, and remove tasks easily, either by typing or speaking.
6+
7+
8+
Features
9+
-Add tasks by typing into the input field.
10+
-Add tasks via voice commands using the microphone.
11+
-Remove selected tasks from the list.
12+
-Simple, intuitive user interface built with Tkinter.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SpeechRecognition==3.8.1
2+
PyAudio==0.2.11
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import speech_recognition as sr
2+
import tkinter as tk
3+
4+
recognizer = sr.Recognizer()
5+
6+
def listen_and_add():
7+
with sr.Microphone() as source:
8+
audio = recognizer.listen(source)
9+
recognizer.energy_threshold = 10000
10+
recognizer.adjust_for_ambient_noise(source, 1.2)
11+
12+
try:
13+
command = recognizer.recognize_google(audio)
14+
listbox.insert(tk.END, command) # Add recognized voice command to the listbox
15+
speak("Task added: " + command)
16+
except sr.UnknownValueError:
17+
speak("Sorry, I didn't catch that.")
18+
except sr.RequestError:
19+
speak("Sorry, there was an error with the service.")
20+
21+
22+
def speak(text):
23+
print(text)
24+
25+
# Tkinter function to add task via typing
26+
def add_task():
27+
task = entry.get()
28+
if task != "":
29+
listbox.insert(tk.END, task)
30+
entry.delete(0, tk.END)
31+
32+
def remove_task():
33+
try:
34+
selected_task = listbox.curselection()
35+
listbox.delete(selected_task)
36+
except:
37+
speak("Please select a task to remove.")
38+
39+
40+
# Create the main window
41+
root = tk.Tk()
42+
root.title("Voice-Controlled To-Do List")
43+
44+
# Entry widget to input tasks manually
45+
entry = tk.Entry(root, width=35)
46+
entry.pack(pady=10)
47+
48+
# Button to add task via typing
49+
add_button = tk.Button(root, text="Add Task", command=add_task)
50+
add_button.pack(pady=5)
51+
52+
# Button to add task via voice
53+
voice_button = tk.Button(root, text="Add Task by Voice", command=listen_and_add)
54+
voice_button.pack(pady=5)
55+
56+
remove_button = tk.Button(root, text="Remove Task", command=remove_task)
57+
remove_button.pack(pady=5)
58+
59+
60+
listbox = tk.Listbox(root, width=50, height=10)
61+
listbox.pack(pady=10)
62+
63+
64+
root.mainloop()

0 commit comments

Comments
 (0)
0