blob: 693c96e453dbccd7164232b6be41eee786d6551c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#
# 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 ())
|