summaryrefslogtreecommitdiffstats
path: root/Demo/sgi/cd
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-04-15 17:52:27 (GMT)
committerGuido van Rossum <guido@python.org>1992-04-15 17:52:27 (GMT)
commitf8b7e926e099b68589b95d068036a8062bca4f01 (patch)
tree80218a82042bbb686b0de35110942eaad839bed8 /Demo/sgi/cd
parent08d962260edb5a3403e01ea3714bee2c58ca9d4d (diff)
downloadcpython-f8b7e926e099b68589b95d068036a8062bca4f01.zip
cpython-f8b7e926e099b68589b95d068036a8062bca4f01.tar.gz
cpython-f8b7e926e099b68589b95d068036a8062bca4f01.tar.bz2
Initial revision
Diffstat (limited to 'Demo/sgi/cd')
-rwxr-xr-xDemo/sgi/cd/cdaiff.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/Demo/sgi/cd/cdaiff.py b/Demo/sgi/cd/cdaiff.py
new file mode 100755
index 0000000..83463a7
--- /dev/null
+++ b/Demo/sgi/cd/cdaiff.py
@@ -0,0 +1,38 @@
+# Dump CD audio on disk (in AIFF format; stereo, 16 bit samples, 44.1 kHz).
+#
+# Each argument is either a track to play or a quoted 7-tuple:
+# '(track, min1, sec1, frame1, min2, sec2, frame2)'
+# to play the track from min1:sec1:frame1 to min2:sec2:frame2.
+# If track is zero, times are absolute instead.
+
+import sys
+import string
+import readcd
+import aiff
+import AL
+import CD
+
+def writeaudio(a, type, data):
+ a.writesampsraw(data)
+
+def ptimecallback(a, type, (min, sec, frame)):
+ if frame == 0:
+ print 'T =', min, ':', sec
+
+def main():
+ a = aiff.Aiff().init(sys.argv[1], 'w')
+ a.sampwidth = AL.SAMPLE_16
+ a.nchannels = AL.STEREO
+ a.samprate = AL.RATE_44100
+ l = []
+ for arg in sys.argv[2:]:
+ l.append(eval(arg))
+ print l
+ r = readcd.Readcd().init()
+ r.set(l)
+ r.setcallback(CD.AUDIO, writeaudio, a)
+ r.setcallback(CD.PTIME, ptimecallback, None)
+ r.play()
+ a.destroy()
+
+main()