Text2voice

This commit is contained in:
ZomgPonies
2014-01-25 23:08:05 -05:00
parent 85de812986
commit 66c9f533e0
2 changed files with 70 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env python2
'''
WINDOWS ONLY!
You need espeak: http://sourceforge.net/projects/espeak/files/espeak/espeak-1.47/espeak-1.47.11-win.zip/download
SOund eXchange (sox): http://sourceforge.net/projects/sox/files/sox/14.4.1/sox-14.4.1a-win32.zip/download
and WinVorbis for OggEnc: http://winvorbis.stationplaylist.com/WinVorbisSetup.exe
'''
import sys, os, re, string
from subprocess import call
accent = sys.argv[1]
voice = sys.argv[2]
pitch = sys.argv[3]
echo = sys.argv[4]
speed = sys.argv[5]
text = sys.argv[6]
ckey = sys.argv[7]
espeakpath = "C:/Program Files (x86)/eSpeak/command_line/"
playervoicespath = "C:/Users/Administrator/Dropbox/Baystation12/sound/playervoices/"
soxpath = "C:/Program Files (x86)/sox-14-4-1/"
oggencpath = "C:/Program Files (x86)/WinVorbis/"
text = string.replace(text, "39", "'")
command = "\""+espeakpath+"espeak.exe\" -w "+playervoicespath+""+ckey+"u.wav -v"+accent+""+voice+" \""+text+"\" -p "+pitch+" -s "+speed+" -a 100"
# First we make the voice file, sounds/playervoice/keyu.wav
call(command, shell=True)
command2 = "\""+soxpath+"sox.exe\" "+playervoicespath+""+ckey+"u.wav \""+playervoicespath+""+ckey+".wav\" echo 1 0.5 "+echo+" .5"
# Now we apply effects to it, like echo (there's lots of other effects too)
call(command2, shell=True)
#remove the old keyu.wav
os.remove(playervoicespath+""+ckey+"u.wav")
command3 = "\""+oggencpath+"OggEnc.exe\" "+playervoicespath+""+ckey+".wav"
#Now we turn key.wav into key.ogg to reduce bandwidth
call(command3, shell=True)
#delete the wav
os.remove(playervoicespath+""+ckey+".wav")
sys.exit()