Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
b1ccc6af
Commit
b1ccc6af
authored
Jun 03, 1992
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improvements by Sjoerd
parent
6c6b6094
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
20 deletions
+9
-20
Demo/sgi/cd/cdaiff.py
Demo/sgi/cd/cdaiff.py
+9
-20
No files found.
Demo/sgi/cd/cdaiff.py
View file @
b1ccc6af
# 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
Error
=
'cdaiff.Error'
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'
)
if
len
(
sys
.
argv
)
>
1
:
a
=
aiff
.
Aiff
().
init
(
sys
.
argv
[
1
],
'w'
)
else
:
a
=
aiff
.
Aiff
().
init
(
'@'
,
'w'
)
a
.
sampwidth
=
AL
.
SAMPLE_16
a
.
nchannels
=
AL
.
STEREO
a
.
samprate
=
AL
.
RATE_44100
r
=
readcd
.
Readcd
().
init
()
l
=
[]
for
arg
in
sys
.
argv
[
2
:]:
x
=
eval
(
arg
)
try
:
l
=
len
(
x
)
if
len
(
x
)
<>
2
:
raise
Error
,
'bad argument'
r
.
appendstretch
(
x
[
0
],
x
[
1
])
except
TypeError
:
r
.
appendtrack
(
x
)
r
.
setcallback
(
CD
.
AUDIO
,
writeaudio
,
a
)
r
.
setcallback
(
CD
.
PTIME
,
ptimecallback
,
None
)
try
:
r
.
play
()
except
KeyboardInterrupt
:
pass
r
.
play
()
a
.
destroy
()
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment