2009 306: Difference between revisions

From XPUB & Lens-Based wiki
(New page: Arduino Serial Control * http://principialabs.com/arduino-python-4-axis-servo-control/)
 
No edit summary
 
Line 1: Line 1:
Arduino Serial Control
Arduino Serial Control
* http://principialabs.com/arduino-python-4-axis-servo-control/
* http://principialabs.com/arduino-python-4-axis-servo-control/
A quick solution to play overlapping sound with Python / mplayer:
<source lang="python">
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)
</source>

Latest revision as of 16:56, 11 June 2009

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)