cpython/Demo/sgi/al/rec_play.py

29 lines
434 B
Python
Raw Normal View History

1991-09-15 21:05:15 +00:00
#
# 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:
1994-10-07 10:23:49 +00:00
time.sleep(0.01)
1991-09-15 21:05:15 +00:00
print 'done.'
p.closeport()
while 1 :
playit (recordit ())