top of page

Voice controller Python

import pyttsx import speech voiceEngine = pyttsx.init() rate = voiceEngine.getProperty('rate') volume = voiceEngine.getProperty('volume') voice = voiceEngine.getProperty('voice') print rate print volume print voice

newVolume = 2.0 #newVoiceRate = 160 newVoiceRate = 150 text=r"C:\Users\customer\Documents\nodejs\sublime-scripts\morningprayer.txt" text2 = open(text).read()

while True: voiceEngine.setProperty('volume', newVolume) voiceEngine.setProperty('rate', newVoiceRate) voiceEngine.say('Testing different voice volumes.') voiceEngine.say(text2) voiceEngine.runAndWait()

bottom of page