3 from subprocess import Popen, PIPE
8 def gen_raw(description):
9 for chunk in description:
10 for blob in chunk.raw():
14 def encode(filename, data):
15 print "Writing %s" % filename
16 p = Popen(('oggenc', '-o', filename, '--raw', '--raw-chan=1',
18 stdin=PIPE, cwd='data/sounds')
25 def write(basename, description):
26 return encode('%s.ogg' % basename, gen_raw(description))
30 sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
31 from data.sounds import SOUNDS
32 from naja.gen_sound import Chunk
34 sounds = SOUNDS.keys()
38 description = SOUNDS[sound]
39 if isinstance(description, Chunk):
40 description = (description,)
41 write(sound, description)
44 if __name__ == '__main__':