Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: ba0b6aeda605bec73c90f93fc05dd1cbc4efa9d3 authored by cvs2svn on 12 January 1995, 12:42:09 UTC
This commit was manufactured by cvs2svn to create tag 'r12beta1'.
Tip revision: ba0b6ae
rec_play.py
#
# records an AIFF sample and plays it
# infinity number of times.
#

import time
import al

def recordit () :
	p = al.openport('hello', 'r')
	print 'recording...'
	buf = p.readsamps(500000)
	print 'done.'
	p.closeport()
	
	return buf

def playit (buf) :
	p = al.openport('hello', 'w')
	print 'playing...'
	p.writesamps(buf)
	while p.getfilled() > 0:
		time.sleep(0.01)
	print 'done.'
	p.closeport()

while 1 :
	playit (recordit ())
back to top