Skip to main content

Posts

Showing posts with the label Voice

Sutdown Computer With Voice

There are three requirements-  1. PyAudio — to install pyaudio, go to terminal and type,  pip install pyaudio 2. SpeechRecognition — to install SpeechRecognition, go to terminal and type, pip install speechrecognition 3. Pyttsx3 — to install Pyttsx3, go to terminal and type, pip install pyttsx3 # Importing required modules # importing pyttsx3 import pyttsx3 # importing speech_recognition import speech_recognition as sr # importing os module import os # creating take_commands() function which # can take some audio, Recognize and return # if there are not any errors def take_commands(): # initializing speech_recognition r = sr.Recognizer() # opening physical microphone of computer with sr.Microphone() as source: print('Listening') r.pause_threshold = 0.7 # storing audio/sound to audio variable audio = r.listen(source) try: print("Recognizing") # Recognizing audio using google api ...