This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def escape_XML(str) : | |
str.replace('"',"\042") | |
str.replace('&',"\046") | |
str.replace("'","\047") | |
str.replace('<',"\074") | |
str.replace('>',"\076") | |
return str | |
def ssml_break(msec): | |
return '<break time="'+str(msec)+'"msec/>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
def speak (text): | |
command = "echo '" + text + "'| espeak -v en+m2 -m" | |
subprocess.call(command,shell=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import time | |
import speak | |
while True : | |
message = "The Raspberry Pi time is " + speak.escape_XML(speak.ssml_break(500)) + time.strftime('%I %M %p') | |
speak.say(message) | |
time.sleep(60) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import sys | |
import tty | |
def read_key() : | |
tty.setcbreak(sys.stdin) | |
last = 0 | |
while True : | |
code = ord(sys.stdin.read(1)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import speak | |
import presenter | |
for key in presenter.read_key() : | |
print key | |
speak.say(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import time | |
import speak | |
while True : | |
message = "The Raspberry Pi time is " + speak.escape_XML(speak.ssml_break(500)) + time.strftime('%I %M %p') | |
speak.say(message) | |
time.sleep(60) |
OlderNewer