Everything you always wanted to know about Code8Par4

Jan de Kloe, May 4th, 2003

Information about distances between staves is rather limited in the manual. This short text explains all the details that you may want to need for detailed computation or for programming utilities which handle Score files.

In the Sibelius to Score converter, I computed the vertical distance in inches and put this in Code8Par10. It was at the time the easiest way to get the proper distance between staves and then I did not understand Code8Par4 to the point that I could use it. I was fully aware that Par10 is not used or even known by many, and I knew that one day I would have to bring out a version with proper Par4 settings. This is now the case.

First, we have to understand that distances are computed from the bottom staff lines. It is therefor confusing that the manual speaks about 10 scale steps because it counts from the upper staff line of a staff to the next one above. There are in fact 18 scale steps between bottom staff lines.

Par10 has the distance in inches of its bottom staff line to the bottom staff line of staff 1. Once you have a non zero value in Par10, Par4 is ignored.

Par4 has the distance in vertical scale steps to a default distance. The default distance between staves counted from bottom staff line is 0.7875 inch, independent of the staff size. Since there are 18 vertical scale steps between bottoms of staves when the default is applied, the following table gives distances from the bottom staff.

Default distances to staves (top to bottom)

Staff

Scale steps

cm (*)

inch

11

180

20

7.8750

10

162

18

7.0875

9

144

16

6.3000

8

126

14

5.5125

7

108

12

4.7250

6

90

10

3.9375

5

72

8

3.1500

4

54

6

2.3625

3

36

4

1.5750

2

18

2

0.7875

1

0

0

0.0000

Suppose you want staff 5 at exactly 4 inches from the bottom. The easiest of course would be to set Par10 to 4 but the exercise here is to use Par4.

The default is 3.1500 and the difference is 4.0 3.1500 = 0.8500.

This distance now has to be converted to vertical scale steps. One vertical scale step is 0.7875/18, which is 0.04375.

Note here that the vertical scale step is not equal to the horizontal scale step which is 7.5/200 = 0.0375.

The distance 0.8500 in vertical scale steps is 0.8500/0.04375 = 19.4285.

If the staff size were 1, this would be the value to be put in Par4. But the staff size plays a role in the vertical distance as of this point and needs to be applied. Divide 1 by the staff size and multiply that with the value in scale steps.

For example, if the staff size is .5, then the correction is 1/.5 * 19.4285 = 2 * 19.4285 = 38.8570.

Put that value in Par4 and the vertical distance will be exactly 4 inches.

This brings us to the formula to convert the Par10 (inches) value into the Par4 (vertical scale steps) value. Par2 is the staff number. Par5 has the staff size but if it is zero we must assume 1. After setting Par4 of course we reset Par10 to zero.

Par4 = { Par10 [ ( Par2 1 ) * .7875 ] } / 0.04375 * ( 1 / Par5 )

To demonstrate the correctness of this you can do the following:

Create a MUS file with two staves, staff 1 and staff 5. Both staves have Par7 = 101 to make sure there is only the staff base line. Set Par5 of staff 5 to .5 which is the size. Then set Par4 of staff 5 to 38.8570 to check the effect of the staff size factor, though you do not see the staff size when it has one line.

Then make EPS file which will have

  0 -24000 m
  30000 -24000 l
  s
     20.0300 lw
  0 -8000 m
  30000 -8000 l
  s

These are the two lines defined at 24000 and 8000 of which the difference is 16,000. Since Score uses 4000 points per inch, this is exactly 4 inches.

With thanks to Tom Brodhead for revising this text and suggesting the EPS proof.

(*) Distances in cm are approximate.

Last revised May 6th, 2003.