Mercurial > pyntnclick
changeset 611:4fcc389f4d40 pyntnclick
Remove regen-speech
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 11 Feb 2012 21:08:35 +0200 |
parents | 2d2c1052ee50 |
children | cfc16ded7b34 |
files | scripts/regen-speech.py |
diffstat | 1 files changed, 0 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/regen-speech.py Sat Feb 11 21:02:49 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -#!/usr/bin/env python - -import pygame -import subprocess -import os - -from gamelib.state import initial_state -from gamelib import speech - -from albow.resource import resource_path - -from pygame.locals import SWSURFACE -from gamelib.constants import GameConstants - -# We need this stuff set up so we can load images and whatnot. -pygame.display.init() -pygame.display.set_mode(GameConstants().screen, SWSURFACE) - - -def espeak(text, filename, voice="en-sc"): - """Call espeak. Use espeak --voices for list of voices.""" - tmpfile = "%s.wav" % filename - stdout = open(tmpfile, "wb") - subprocess.call(["espeak", "--stdout", "-v", voice, text], stdout=stdout) - print ["oggenc", tmpfile, "-o", filename] - subprocess.call(["oggenc", tmpfile, "-o", filename]) - os.remove(tmpfile) - - -def main(): - state = initial_state() - for scene in state.scenes.values(): - for thing in scene.things.values(): - texts = getattr(thing, "SPEECH", None) - if texts is None: - continue - for text in texts: - filename = speech.get_filename(thing.name, text) - filename = resource_path("sounds", "speech", filename) - print "[%s: %s] -> %s" % (thing.name, text[:30], filename) - espeak(text, filename) - - -if __name__ == "__main__": - main()