Staging
v0.5.1
https://github.com/python/cpython
Revision 0832165c43cc059ca2d8de0bef09990f6ebdcae0 authored by cvs2svn on 18 March 2002, 16:47:35 UTC, committed by cvs2svn on 18 March 2002, 16:47:35 UTC
1 parent 0c3ea5d
Raw File
Tip revision: 0832165c43cc059ca2d8de0bef09990f6ebdcae0 authored by cvs2svn on 18 March 2002, 16:47:35 UTC
This commit was manufactured by cvs2svn to create tag 'r221c1'.
Tip revision: 0832165
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