summaryrefslogtreecommitdiffstats
path: root/Demo/sgi/al/rec_play.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-09-15 21:05:15 (GMT)
committerGuido van Rossum <guido@python.org>1991-09-15 21:05:15 (GMT)
commit50692d62de3a2aa13aa1ebc56fbe045842a45580 (patch)
treeddc5e42f1a0693f77d8813f026f4077dd632961d /Demo/sgi/al/rec_play.py
parent4f5eafb0cf0d5144813c4047d934063b64229804 (diff)
downloadcpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.zip
cpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.tar.gz
cpython-50692d62de3a2aa13aa1ebc56fbe045842a45580.tar.bz2
Initial revision
Diffstat (limited to 'Demo/sgi/al/rec_play.py')
-rwxr-xr-xDemo/sgi/al/rec_play.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/Demo/sgi/al/rec_play.py b/Demo/sgi/al/rec_play.py
new file mode 100755
index 0000000..e538b99
--- /dev/null
+++ b/Demo/sgi/al/rec_play.py
@@ -0,0 +1,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.millisleep(10)
+ print 'done.'
+ p.closeport()
+
+while 1 :
+ playit (recordit ())