#!/usr/bin/python

import sys, binascii

OUTFILE = '/tmp/test.py'


f = open(sys.argv[1], 'rb')

f2 = open(OUTFILE, 'w')

f2.write("""
import binascii
from cStringIO import StringIO
from pygame import mixer

encoded_sound = %s

sound_string = binascii.a2b_base64(encoded_sound)

f = StringIO(sound_string)

# for testing
f2 = open('%s.wav', 'wb')
f2.write(sound_string)


mixer.init()
sound = mixer.Sound(f)
sound.play()

import time
time.sleep(2) # so the sound has time to play

""" % (repr(binascii.b2a_base64(f.read())), OUTFILE))
