Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8b7e92

Browse files
committed
Initial revision
1 parent 08d9622 commit f8b7e92

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

Demo/sgi/cd/cdaiff.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Dump CD audio on disk (in AIFF format; stereo, 16 bit samples, 44.1 kHz).
2+
#
3+
# Each argument is either a track to play or a quoted 7-tuple:
4+
# '(track, min1, sec1, frame1, min2, sec2, frame2)'
5+
# to play the track from min1:sec1:frame1 to min2:sec2:frame2.
6+
# If track is zero, times are absolute instead.
7+
8+
import sys
9+
import string
10+
import readcd
11+
import aiff
12+
import AL
13+
import CD
14+
15+
def writeaudio(a, type, data):
16+
a.writesampsraw(data)
17+
18+
def ptimecallback(a, type, (min, sec, frame)):
19+
if frame == 0:
20+
print 'T =', min, ':', sec
21+
22+
def main():
23+
a = aiff.Aiff().init(sys.argv[1], 'w')
24+
a.sampwidth = AL.SAMPLE_16
25+
a.nchannels = AL.STEREO
26+
a.samprate = AL.RATE_44100
27+
l = []
28+
for arg in sys.argv[2:]:
29+
l.append(eval(arg))
30+
print l
31+
r = readcd.Readcd().init()
32+
r.set(l)
33+
r.setcallback(CD.AUDIO, writeaudio, a)
34+
r.setcallback(CD.PTIME, ptimecallback, None)
35+
r.play()
36+
a.destroy()
37+
38+
main()

0 commit comments

Comments
 (0)