back to Alan Crowe's home page

Print your own blank music sheets

This page contains a PostScript program, intended for printing music manuscript paper. Although music manuscript paper is expensive to buy, you might not save money, because inkjet printers are expensive to run. However the rudimentary user interface allows you to set your own margins, adjust the spacing and the number of staves, and to group the staves. As downloaded the program groups the staves in pairs, which you might like for piano music.

The user interface is less sophisticated than the term rudimentary usually implies. I intend you to use any old editor to hack at the source code as a piece of plain text. Then you ask your printer driver to interpret the PostScript for you.

Installing
Save this page, and hack the PostScript free from the HTML with any old editor (such as Notepad) set to plain text
De-installing
Delete the file
Virus safety
There is nowhere for one to hide
Turning off stave grouping
Set the staves_in_group to the number of staves you want on the page, and the groups_on_page to 1. (Other ways also work.)
Documentation
In PostScript `%' starts a comment. Read them. The code has been written so that your guesses will turn out right.


Single column Two columns Three columns

% First line of PostScript
% Conversion routines, which turn
% popular units of measurement into
% PostScript's internal point of 1/72 of an inch
/inches { 72 mul } def
/mm { 25.4 div inches } def
/cm { 10 mul mm } def
/metres { 1000 mul mm } def


% Useful information, which you leave alone
/A4height 297.3 mm def
/A4width 210.2 mm def


% This is where you set the paper size
% Define and use a symbolic name for your paper size,
% or just replace the symbolic name with a distance
/paper_height A4height def
/paper_width A4width def


%---------------+
% Customisation |
%---------------+
% Edit these to your taste
% Mixture of units is illustrative only
/left_margin 2 cm def
/right_margin 20 mm def
/top_margin 2.3 inches def
/bottom_margin 0.03 metres def
/staves_in_group 2 def
/groups_on_page 5 def
/stave_gap 8 mm def
/group_gap 2 3 div inches def
% I've set the group_gap as two thirds of an inch.
% You should change this to 
% /group_gap 17 mm def
% or people will think you are pretensious!

% The heaviness of the lines is set with a 
% PostScript built in command, so the syntax is different
1 setlinewidth
% Officially the number is a physical width
% and you can create zebra stripes with `1 cm setlinewidth'
% but usually you want them as narrow as suits your printer

% Portrait only, unless you swap the width and height
% and tell your printer driver that you want landscape 
% Thats it, stop reading, only gory details below this line
%----------------------------------------------------------
% Simple calculations of where the drawing 
% area sits on the page
/left left_margin def % redundant definition to preserve symetry of notation
/bottom bottom_margin def % ditto
/right paper_width right_margin sub def % origin at bottom left
/top paper_height top_margin sub def
/line_length right left sub def
/drawing_height top bottom sub def

% Tricky calculations
/total_gaps % Here be dragons
    stave_gap staves_in_group 1 sub mul groups_on_page mul
    group_gap groups_on_page 1 sub mul
    add
def
/no_of_staves staves_in_group groups_on_page mul def
/space_per_stave drawing_height total_gaps sub no_of_staves div def
/space_per_group 
    space_per_stave staves_in_group mul
    stave_gap staves_in_group 1 sub mul
    add
def
/line_spacing space_per_stave 4 div def % five lines = four spaces
/stave_pitch space_per_stave stave_gap add def % pitch as in repetition distance
/group_pitch space_per_group group_gap add def

/draw_stave % height_of_bottom_line => _
{
    % set up `for loop' with
    % init = height of bottom line
    % incr = line spacing
    % limit = height of top line + rounding protection
    dup space_per_stave add % height of top line of stave
    line_spacing exch 1 add
    {
	left exch moveto
	line_length 0 rlineto
    }
    for
    stroke
}
def

/draw_group % height_of_bottom_line => _

{
    % set up `for loop' with
    % init = base line of bottom stave of group
    % incr = vertical motion
    % limit = base line of top stave of group + rounding protection
    dup space_per_group add space_per_stave sub
    stave_pitch exch 1 add
    {
        draw_stave
    }
    for
}
def

% set up `for loop' with
% init = base line of bottom group
% incr = vertical motion
% limit = base line of top group + rounding protection
bottom
group_pitch
top space_per_group sub 1 add
{
  draw_group
}
for
showpage
% Last line of PostScript