2009 306

From Media Design: Networked & Lens-Based wiki
Jump to navigation Jump to search

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)