Notes
Notes - notes.io |
from tkinter import ttk
import speech_recognition as sr
import pyttsx3
# Initialize the text-to-speech engine
engine = pyttsx3.init()
# Function to recognize emotion from speech
def recognize_emotion():
try:
recognizer = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
engine.say("Listening...")
engine.runAndWait()
audio_data = recognizer.listen(source, timeout=5)
text = recognizer.recognize_google(audio_data)
emotion = "Neutral" # Replace with your emotion recognition logic
result_label.config(text=f"Emotion: {emotion}")
engine.say(f"The recognized emotion is {emotion}")
engine.runAndWait()
except sr.UnknownValueError:
result_label.config(text="Speech not recognized. Try again.")
except sr.RequestError as e:
result_label.config(text=f"Error with the speech recognition service: {e}")
# Function to handle form submission
def submit_form():
name = name_entry.get()
language = language_var.get()
engine.say(f"Hello {name}, you have selected {language} as your language preference.")
engine.runAndWait()
# Create the main application window
app = tk.Tk()
app.title("Speech Emotion Recognition")
# Create GUI components
record_button = ttk.Button(app, text="Record", command=recognize_emotion)
# Form components
form_frame = ttk.LabelFrame(app, text="User Information")
name_label = ttk.Label(form_frame, text="Name:")
name_entry = ttk.Entry(form_frame)
language_label = ttk.Label(form_frame, text="Language:")
language_var = tk.StringVar()
language_combobox = ttk.Combobox(form_frame, textvariable=language_var, values=["English", "Spanish", "French"])
submit_button = ttk.Button(form_frame, text="Submit", command=submit_form)
result_label = ttk.Label(app, text="Emotion: ")
# Pack GUI components
record_button.pack(pady=10)
# Pack form components
form_frame.pack(pady=10, padx=10, fill="both", expand=True)
name_label.grid(row=0, column=0, padx=5, pady=5, sticky="E")
name_entry.grid(row=0, column=1, padx=5, pady=5, sticky="W")
language_label.grid(row=1, column=0, padx=5, pady=5, sticky="E")
language_combobox.grid(row=1, column=1, padx=5, pady=5, sticky="W")
submit_button.grid(row=2, columnspan=2, pady=10)
# Pack result label
result_label.pack(pady=10)
# Run the application
app.mainloop()
|
Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 12 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team