repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git]
/
Demo
/
sgi
/
al
/
rec_play.py
blob
693c96e453dbccd7164232b6be41eee786d6551c
1
#
2
# records an AIFF sample and plays it
3
# infinity number of times.
4
#
5
6
import
time
7
import
al
8
9
def
recordit
() :
10
p
=
al
.
openport
(
'hello'
,
'r'
)
11
print
'recording...'
12
buf
=
p
.
readsamps
(
500000
)
13
print
'done.'
14
p
.
closeport
()
15
16
return
buf
17
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
()
26
27
while
1
:
28
playit
(
recordit
())