Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git] / Demo / sgi / al / rec_play.py
blob693c96e453dbccd7164232b6be41eee786d6551c
2 # records an AIFF sample and plays it
3 # infinity number of times.
6 import time
7 import al
9 def recordit () :
10 p = al.openport('hello', 'r')
11 print 'recording...'
12 buf = p.readsamps(500000)
13 print 'done.'
14 p.closeport()
16 return buf
18 def playit (buf) :
19 p = al.openport('hello', 'w')
20 print 'playing...'
21 p.writesamps(buf)
22 while p.getfilled() > 0:
23 time.sleep(0.01)
24 print 'done.'
25 p.closeport()
27 while 1 :
28 playit (recordit ())