You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.3 KiB
Python

8 years ago
#! /usr/bin/env python
import re, subprocess, random
from time import sleep
# requires: espeak to be installed
dic={
"narrator": "en-us",
}
f=open("/media/floppy/detail_of_attack.txt","r")
8 years ago
txt=f.readlines()
for line in txt:
print line
# # play time
subprocess.call(["espeak", "-v", dic['narrator'], "-p", "20", line]) # narrator speaks: time and character
# sleep(0.5) #short pause before sentence
# print sentence
# if "*CLASSIFIED*" in sentence: #"*expletive*" in sentence is True:
# sentence_parts=re.split(r"(\*\w+\*)", sentence)
# print sentence_parts
# for part in sentence_parts:
# if part == '*CLASSIFIED*':
# print 'EXPLETIVE', part
# subprocess.call(["aplay", 'swear.wav'])
# else:
# print 'SPEECH', part
# subprocess.call(["espeak", part, "-v", voice]) # character speaks: his
# sleep(float(random.randint(1,10))/100)
# else: # line w/out time or character (narrator)
# print "NARRATOR"
# subprocess.call(["espeak", line, "-v", dic['narrator'], "-p", "20"])
sleep(.5) # make pause after each text line