Skip to content

Commit

Permalink
Merge pull request #85 from ozamed/master
Browse files Browse the repository at this point in the history
Speech To Text & Text To Speech
  • Loading branch information
fineanmol authored Oct 17, 2020
2 parents 7844193 + e2a2f8b commit 28fa7ab
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hello guys, this is an example.
Empty file.
22 changes: 22 additions & 0 deletions Program's_Contributed_By_Contributors/VoiceIO/main/voiceInput.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import speech_recognition as sr

def SpeechRecognition():
r = sr.Recognizer()
with sr.Microphone() as source:
print('Say something...')
r.pause_threshold = 1
r.adjust_for_ambient_noise(source, duration=1)
audio = r.listen(source)
try:
outputFile = open("speechOutput.txt","a")
userSpeech = r.recognize_google(audio).lower()
print('You said: ' + userSpeech + '\n')
outputFile.write(userSpeech + '\n')
outputFile.close()

except sr.UnknownValueError:
print('....')

while True:
SpeechRecognition()

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import pyttsx3

engine = pyttsx3.init()

inputFile = open("speechInput.txt","r")

engine.say(inputFile.read())
engine.runAndWait()
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyttsx3==2.87
SpeechRecognition==3.8.1

0 comments on commit 28fa7ab

Please sign in to comment.