2009 306

From XPUB & Lens-Based wiki
Revision as of 16:56, 11 June 2009 by Michael Murtaugh (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Arduino Serial Control

A quick solution to play overlapping sound with Python / mplayer:

import os
from glob import glob
import subprocess
from random import choice
from time import sleep

sounds = glob("sounds/*.wav")
print sounds

while True:
	rsound = choice(sounds)
	cmd = """mplayer "%s" -endpos 5 &""" % (rsound)
	# print cmd
	os.system(cmd)
	sleep(4)