For each of the four scripts below, click on the script name to download the script. Clicking on the filename following "creates" will download a PDF file that was produced by the running the script and then opening the PostScript file with Preview and saving it out in PDF format.
python draw_staff.py
to see the "usage" message for draw_staff.py.
For each of the scripts, the argument descriptions are surrounded by angle brackets, like this: <output-filename>. This means, for example, that the name of the output file would be specified as an argument at that position in the list of arguments. For clarity, some of the argument lists extend over two lines, but you should specify all the arguments on a single line when you run the script.
Try running each example first, and then make changes to the arguments. Each script creates a PostScript file. Use the open command with the PostScript file as an argument to convert it to PDF format.
Usage: draw_staff.py <x> <y> <length> <output-filename>
Draw a musical staff with the lower left corner at <x>,<y> of length
<length>, writing the PostScript to <output-filename>.
Example:
python draw_staff.py 36 720 540 draw_staff.ps
Usage: random_draw.py <number-of-notes> <x> <y> <width> <height>
<output-filename>
Place random musical characters in random positions in a box
<width> by <height> in size, with the lower left corner at <x>,<y>.
Example:
python random_draw.py 1000 36 36 540 720 random_draw.ps
Usage: basic_notes.py <x-pos> <note-number> <accidental> <output-filename>
Print a single note. The note is positioned <x-pos> points from the
beginning of the staff. The note number is a note in the C major
scale, with 0 equal to two octaves below middle C. The accidental sign
is defined by one of the following numbers:
-1 Flat
-.5 Quarter-tone flat
0 Natural
.5 Quarter-tone sharp
1 Sharp
The PostScript data is written to the file <output-filename>.
Example:
python basic_notes.py 72 9 1 basic_notes.ps
Usage: notes.py <note-count> <start-time> <end-time>
<lower-octave> <upper-octave> <output-filename>
Print <note-count> notes. A single staff is a time unit of 1. The
octave bounds extend above and below the staff, so "0 1" means notes
within the staff; "-1 2" extends above and below the staff by an
octave. The PostScript data is written to <output-filename>.
Example:
python notes.py 500 0 14 0 1 notes.ps