6.
Software Requirements:
1. Programming Language: Python (with libraries like
SpeechRecognition, pyttsx3, etc.).
2. Operating System: Windows/Linux/MacOS.
3. IDE: Visual Studio Code, PyCharm, or Jupyter Notebook.
4. APIs: Google Speech-to-Text API or similar for speech recognition.
5. Database: SQLite or any lightweight database for storing user
preferences.
7. Hardware Requirements:
1. Processor: Minimum Intel i3 or equivalent.
2. RAM: At least 4GB (8GB recommended for smoother performance).
3. Microphone: For capturing voice commands.
4. Speakers: For audio feedback.
5. Storage: Minimum 500MB free space for program and dependencies.
SYSTEM DIAGRAM:
User Interface
Input: Microphone Output: Speakers
Speech Recognition (Speech-to-Text)
Command Parser (Intent Recognition Layer)
Execution Module
(Executes system-level actions like opening apps, changing settings, etc.)
Feedback Generation Unit
(Text-to-Speech for audio response)
USECASE DIAGRAM:
User
Provide Voice Command
Speech Recognition System
Command Parsing Unit
Execution module Feedback System
(Perform Task) (Text-to-Speech)
Perform System Task Provide Feedback
PROGRAM:
import speech_recognition as sr
import pyttsx3
import os
# Function to convert text to speech
def speak(text):
engine = pyttsx3.init()
engine.say(text)
engine.runAndWait()
# Function to capture and recognize speech
def listen():
recognizer = sr.Recognizer()
with sr.Microphone() as source:
print("Listening...")
audio = recognizer.listen(source)
try:
command = recognizer.recognize_google(audio)
print(f"You said: {command}")
return command.lower()
except sr.UnknownValueError:
speak("Sorry, I didn't catch that.")
return None
# Function to execute recognized commands
def execute_command(command):
if "open notepad" in command:
os.system("notepad")
speak("Opening Notepad.")
elif "play music" in command:
os.system("start wmplayer") # Command for Windows Media Player
speak("Playing music.")
elif "exit" in command:
speak("Goodbye!")
exit()
else:
speak("Command not recognized.")
# Main program loop
if __name__ == "__main__":
speak("Hello! I am your AI assistant. How can I help you?")
while True:
user_command = listen()
if user_command:
execute_command(user_command)