                                                                                                                                                                >>37<<5552 >>37<<///>>16<< >>37<<5552       44444  s>>37<<0              >>16<<///>>12<< >>16<<///>>16<< >>37<<242>>37<< >>37<<5552 >>17<<000>>17<< 11>>37<<11 >>37<<vv// >>37<<55>>15<<s                                               




                       PDP-1 COMPUTER
             ELECTRICAL ENGINEERING DEPARTMENT
           MASSACHUSETTS INSTITUTE OF TECHNOLOGY
               CAMBRIDGE, MASSACHUSETTS 02139


















                          PDP 43-2

                       MUSIC PROGRAMS

























                        Nov. 2, 1970










                >>13<<>>12<<                                


                           Music Compiler


   Music  to be coded  for the compiler  must be arranged  in one or
more "sections"  (e.g.  movements),  each with  up to  six parts  or
voices. Each part may play only one note at a time. The last part of
the last section should end with  the word "stop">>40<<, the last part  of
other sections should end with "append">>40<<, other parts should end with
"end".

   Each part has a number  of measures, separated by slashes  ("/"),
numbered  starting with 1.  A  number alone (not part  of a note) is
considered a  bar  label,  and is  checked  against  the  compiler's
measure  count.  It is wise to  use such bar labels frequently>>40<<, they
warn of missing or duplicated  measures, and also serve to  identify
the measures they appear in.

   The  total duration of a measure is specified by the word "units"
followed by the number  of thirty-second notes  in a measure.   This
number  is the time  signature (taken as a  fraction) times 32.  The
"units" command  may  appear  anywhere, and  takes  effect  for  all
subsequent  measures  (until the  next  use of  "units").   For each
measure, the compiler checks the total duration of the notes in  the
measure  against the  expected total  given in  the "units" command.


   There are four  commands to inform  the compiler of  the clef  in
which  the notes  appear>>40<<, these  may appear  anywhere in  the music.






    treble          alto          tenor            bass


   The pitch of  a note is  indicated by a  number representing  the
position  of the  note on  the staff.   Lines are  odd-numbered, and
spaces are even-numbered.








   The number  may  be  as high  as  necessary,  and as  low  as  0.
Including  the letter  "a" (above)  in a note  adds 12  to the pitch
number>>40<<, "b" (below) subtracts  12, so notes below  the staff may  be
coded.   Note that if the current  clef is "treble", "b" makes pitch
numbers relative to a bass clef, and vice versa for "a". "a" and "b"
may  occur more than once in a note, and their effect is cumulative.









                >>13<<f                                
   Accidental signs,  and  the characters  to  signify them  to  the
compiler,  are shown below.  These characters may be placed anywhere
in the  note  that  they  affect.  In  accord  with  standard  music
notation,  an accidental affects all subsequent notes in the measure
on the same position in the staff.




	)          (          -          ((         --
	natural  sharp      flat        double    double
	                                sharp      flat


   A key signature  can be stated  at any time,  and applies to  all
subsequent  notes.  The word "key" is followed by a letter "(", "-",
or ")" for sharps, flats, and no sharps or flats respectively.   The
number  of sharps or flats can be  specified either by a number with
the letter, or by using one "(" or "-" for each sharp or flat.   For
example,  three sharps could be specified either by "key (3" or "key
(((".


   A note's duration is  specified by a  number as indicated  below.
Only these seven numbers may be used.



  note



  rest


 number     1       2       4       8       16       32       64

   Including  a dot (".") in a note  adds an amount to its duration>>40<<.
the first dot in a note adds one-half the duration of the note>>40<<, each
succeeding  dot adds half the duration of  the dot before it.  It is
occasionally convenient  to add  a smaller  fraction than  half  the
note's duration.  To enable this, the compiler interprets the letter
"x" in a note to mean, "halve the value of the dot". Periods and x's
may be used anywhere in the note, and need not be contiguous.  Their
order is significant only among themselves.

   Notes in triplets are indicated  as such by including the  letter
"c"  anywhere in  the note.  The  "c" makes the  note two-thirds its
usual duration.  Dots and x's may be included.
















                >>13<<>>17<<                                
   A pitch number and a duration number conjoined form a note.   The
numbers must be in the order "pitch - duration".  To distinguish the
two numbers,  they must  be  separated by  one or  more  non-numeric
characters>>40<<, the letter "t" is available especially for this purpose.
No character may be placed between  the digits of a pitch number  or
duration number. Notes are separated by space, tab, carriage return,
or slash.

   A rest is  expressed by  the letter  "r" and  a duration  number.
Dots, x's, and c's may be included.

   A comma may be used alone as a note, meaning to copy the previous
note exactly.  Also, the comma may be used with r or a pitch  number
to  form a note>>40<<, the  comma in this case  indicates to copy only the
duration from the previous note. A comma will copy a "c" only if the
note in which the "c" occurs did not contain a comma.


   Two  notes played in  succession are made distinct  to the ear by
articulation, the  effect of  a short  duration of  silence  between
them.  The duration of the preceding note is shortened by the amount
taken for the period of articulation.  The articulation following  a
note  can be expressed  to the compiler  by including an identifying
letter  anywhere  in  the  note>>40<<,  the  five  letters  available  are
explained in the following table. The effect of these letters is not
copied by comma, unless the comma is used alone.

letter  name      duration       duration        used for
                  of note        of articulation

l       legato    1              0               slurs, legato notes

e       eighth    7/8            1/8             notes not specially
                                                 marked

q       quarter   3/4            1/4             alternative to "e"

h       half      1/2            1/2             staccato for
                                                 organ works

s       staccato  3/8            5/8             alternative to "h"

   The articulation of notes not containing an explicit articulation
letter  is governed by the default  articulation mode.  This mode is
set by  the single  letters "l",  "e", "h",  "q", and  "s".  At  the
beginning  of each part the  compiler is in the  "e" mode.  Any note
which immediately precedes a rest in the same measure is  automatic-
ally made legato unless it contains an explicit articulation letter.

















                >>13<<5                                
   Various embellishment signs may  appear on a note  in a piece  of
music,  indicating that the note is to be performed more elaborately
than written. Below are (a) the symbols (as used by C. P. E. Bach in
his  "Essay on the  True Art of  Playing Keyboard Instruments")>>40<<, (b)
the patterns compiled>>40<<, (c)  the letter used  to signify that  embel-
lishment in a note>>40<<, (d) the name of the embellishment.



(a)





(b)




(c)         p            d          u            k            f
(d)      mordent     inverted      turn     three note       full
                      mordent                  trill         turn


(a)





(b)



(c)           m             n               o                w
(d)         trill      trill with     odd numbered       inverted
                       grace notes        trill            trill

   The  speed at  which trills  and other  embellishments are played
depends on the  trill time.  The  trill time is  set by the  command
"trill"  followed by  a note duration.   It is  initially 32.  Notes
marked above as thirty-second notes in embellishments "d", "u", "m",
"n", "o", and "w" are given the trill time duration>>40<<, notes marked as
sixty-fourth notes in "p"  are given half  the trill time  duration.
The trill time will be stretched or compressed slightly to make "m",
"n", and "o" come out with the right number of notes (even or  odd).
For  "k" and "f",  the note duration  is evenly divided  by 3 and 5,
respectively.  Comma does not copy embellishments.

   An accidental on the  principal note of  an embellishment can  be
indicated  by a "(", "-", or ")"  in the note.  Accidentals on other
notes can be specified by the following letters. These do not affect
subsequent notes the way accidentals do.

	i - raise upper tone
	j - depress upper tone
	y - raise lower tone
	z - depress lower tone






                >>13<<w                                

































































                >>13<<m                                   A  grace  note (appoggiatura)  steals its  playing time  from the
first non-grace note to follow>>40<<.  such a note should have  sufficient
duration  to sound itself as well.  A duration may be specified in a
grace note, either  by a  number or  by a comma>>40<<,  if a  time is  not
specified,  a thirty-second note  will be compiled.   The letter "g"
anywhere in a note marks it a grace note.

   The volume of a part can be specified by the word "vol"  followed
by  a number from  0 to 15.   These volume commands  may be given as
often as necessary, and apply only to the part in which they appear.
While  the  compiler  allows  for 16  different  volume  levels, the
present music hardware has  only 8 different  levels>>40<<, thus, "vol  0"
and  "vol 1" will  play at the  same loudness.  One  of these may be
preferred, however, for  special effects with  "cresc" (q.v.).   The
following words are also available for the most common vol commands,
and are almost always used instead of "vol">>40<<.

	ppp  vol 0
	pp   vol 2
	p    vol 4
	mp   vol 6
	mf   vol 9
	f    vol 11
	ff   vol 13
	fff  vol 15


   The words  "cresc"  or "dim"  direct  the compiler  to  gradually
increase  or decrease the volume from its value where the "cresc" or
"dim" occurred  to the  next occurrence  of a  volume command.   The
number  of volume steps from the starting volume to the final volume
is evenly divided within the intervening time.

	An example of the action of cresc>>40<<.

	mp cresc 5l1 f

	becomes
	vol
	11
	10
	 9
	 8
	 7
	 6
	  0                  1  time

   Accented notes may be coded by including the letter "v"  anywhere
in  the note.  This causes  the volume of the  note to be raised two
volume levels for a duration depending on the note duration as shown
in the following table>>40<<.

	duration of note   duration of accent

	      note < 1/64  note

	1/64 >>40<<< note < 1/8  1/64

	1/8 >>40<<< note < 1/4   note/8







                >>13<<t                                	1/4 >>40<<< note         1/32

































































                >>13<<g                                   Two  v's in a note  will raise the volume  four levels, etc.  The
word "accent"  followed  by  a  number  from  0  to  15  causes  all
succeeding  notes  (until the  next  "accent") to  be  accented that
number of volume levels.  "v" may still be used, and its effect will
be added to the standard accent.

   The tempo of a piece of music is expressed to the compiler by the
command "tempo" followed by the number of quarter notes per  minute.
A  "tempo" command  appearing in  any voice  will be  applied to all
voices>>40<<, hence only one part need contain tempo information.

   The words "accel"  or "ritard" direct  the compiler to  gradually
increase  or decrease the tempo from  its value where the "accel" or
"ritard" occurred  to  the  next  occurrence  of  a  tempo  command.

   The  command "copy" may be used to duplicate previous measures in
the same  part.  "Copy"  should be  followed by  the number  of  the
measure to start copying from, and the number of the last measure to
be copied.  The second number may be omitted if only one measure  is
to  be copied>>40<<, in this case,  the first number should be immediately
followed by a carriage return.  The second number may be higher than
the current measure number.  "Copy" need not be followed by a slash.
The measures are copied exactly>>40<<, they are not modified by change  in
the  mode of  articulation, accent, transposition,  clef, or measure
length>>40<<, nor do they change any  of these for non-copied measures  to
follow. They will be performed at a different tempo if that has been
changed, however.  The  copied measures will  begin with the  volume
that  was current when "copy" was  given, and if they contain volume
changes, subsequent measures will be affected.

   In addition to "copy, "open" and "close" are available for coding
repeats.   Measures  between "open"  and  "close" will  be repeated.
"Open" and "close" need not coincide with ends of measures, but must
be in corresponding places. After "close", the bar numbering must be
advanced to skip over the repeated measures.

   A given line may be silent for one or more measures.  This should
be  expressed to the compiler by  the command "rest" followed by the
number of inactive  measures.  They  will all be  given the  current
measure length.  There need not be a slash directly after the "rest"
command.

   The compiler is able  to transpose music  with the commands  "up"
and  "down">>40<<, a number follows  the transposition command to indicate
the number of  semitones that the  compiled music will  be above  or
below the music as written in the text.  These commands may occur at
any point in the text and  take effect immediately.  To restore  the
compiled  music to  no transposition, say  "up 0" or  "down 0".  The
compiler starts each part at 0 transposition.

   Because the frequencies generated by the music player are  exact,
parts  which play notes in unison or  an octave apart may exactly or
nearly cancel each other, depending on the relative phase of the two
notes.  To counteract this, there is a provision for detuning parts.
The command "tune"  followed by  a number from  0 to  7 directs  the
player  to slightly alter the normal frequencies of all notes in the
part.  Normal tuning is 4>>40<<.  a higher number raises the pitch, and  a
lower  number lowers  the pitch.   If no  tuning is  specified, 4 is
assumed. Normally, parts are left at tuning 4 unless phase proves to
be a problem.






                >>13<<i                                
   A  vertical bar ("| ") begins a comment>>40<<, everything up to the next
carriage return is ignored.  In addition, anything in upper case  is
ignored.

   The  compiler allows great flexibility  in the arrangement of the
input text,  but usually  it proves  worthwhile to  follow a  format
which is stricter than necessary.  One such format, which has proven
satisfactory, is described below.

(a) After the title the clef, time, key, tuning, and tempo are
    specified in any order.

(b) Each line represents one measure>>40<<, the measure number is put at
    the beginning, and "space" is used to separate notes>>40<<, the line
    is ended with a slash.

(c) If a measure is too long to fit on one line, it is continued
    on the next line, indented by a tab.  Only the last line of 
    measure ends with a slash.

(d) The commands "copy" and "rest" get a line to themselves, with
    no slash at the end.

	A short example follows.







	treble units 32 key -1
	1 6t2 7l4 8,/
	2 9s8 2s, 11b4. 2t16 r4x./
	3 6f4 5c8 4, , 6h2/
	stop



   To run the compiler,  load a copy of  "mcomp" from Dectape 0  and
start  it  at 0  or  102.  Te  compiler  expects the  input  text in
Expensive Typewriter's text  buffer.  It  places the  output on  the
drum,  where it should be  saved on a Dectape  using a standard file
system.





















                >>13<<-                                
   When the compiler detects an error, it prints the page, line, and
measure  number at which the error was found, the line in error, and
a three-letter error code.  Following is a list of the error  codes.

mts	Measure too short.  Total duration does not match duration
	specified in units command.

mtl	Measure too long.  Ditto.

nst    Text ends without "stop" command.

cnt	Cresc or accel still pending at end of part.

ncl	Repeat still pending at end of part, i.e. missing close.

itg	Illegal time in grace note.  Following note must be in
	same measure.

The following print the offending syllable in red.

nps	No pseudo-instruction.  The compiler doesn't recognize
	the syllable.

tmo	Too many opens, i.e. close is missing.

nop	No open corresponding to this close.

rtc	Close in same measure as open.

rtl	Repeat too long, i.e. position of close doesn't match
	position of open.

rts	Repeat too short, i.e. ditto.

vor	Volume out of range.  Must be 0>>40<<<vol>>40<<<15.

tur	Tune out of range.  Must be 0>>40<<<tune>>40<<<7.

cbv	Cresc before any volume command, or
	accel before tempo.

cic	Cresc in cresc, without intervening volume command, or
	accel in accel.

acr	Accent out of range.  Must be 0>>40<<<accent>>40<<<15.

tor	Tempo out of range.  Must be 1>>40<<<tempo>>40<<<1023.

atf	Accel or ritard too fast.

blc	Bad bar label in copy.

brc	Bad range in copy.

bbl	Bad bar label.










                >>13<<f                                

tmc	Too many commas.  Only one should be used.

tmg	Too many g's.  Ditto.

tmr	Too many r's.  Ditto.

tme	Too many embellishments.  Ditto.

tms	Too many articulations.  Ditto.

tma	Too many accidentals.

tmf	Too many fields.  Pitch and duration are overspecified.

tff	Too few fields.  Pitch and duration must both be specified.

itg	Illegal time in grace note.  Following note is too short.

air	Articulation, accidental, accent, or embellishment in rest.

eit	Note too short for embellishment.  This can be fixed by
	making the trill time shorter.

uat	Pitch too high or too low.

unc	Comma used before any duration has been given.

tic	Comma used with dot.

nna	Non-numeric argument to a command.

ert	Duration field is not 1, 2, 4, 8, 16, 32, or 64.

dtu	Dot time underflow.  Too many dots and x's.






























                >>13<<                                                             Music Player


   There  are  two versions  of  the music  player>>40<<,  one for  use in
timesharing, and one for non-timesharing.  Since the non-timesharing
version  has complete  control of  timing, the  quality of  music is
somewhat higher>>40<<, however, running it requires that no other users be
on the computer.

   To  run the  timesharing music player,  load a  copy of "tsmplay"
from Dectape 0 and start it at 0. To run the non-timesharing player,
load  "ntsmplay" from Dectape 0, start  at 0, and follow the printed
directions. The player accepts the following commands, of which only
as  many characters as are necessary to distinguish the command from
other commands need be typed.

tape n	Specifies the tape unit for loading music.  The player
	loads music from files which are the saved output of the
	compiler.

untape	Rewinds the tape.

load filename
	Reads the music on file "filename".  The music is stored
	in an internal buffer.

append filename
	Appends the music in file filename" to music previously
	loaded into the buffer.

go	Plays the music which has been loaded.

play filename
	Loads "filename" and plays it.

wait	In timesharing, waits for a key to be struck on the typewriter,
	then plays the music in the buffer.  Out of timesharing, waits
	for the continue switch to be depressed, then plays.  Used to
	start playing without the clatter of typewriters.

tempo n
	Multiplies the overall speed of playing by n/1000 (decimal).
	Used for debugging music without having to recompile.  Music
	must be reloaded for the change in tempo to take effect.

tune n,m,...
	Overrides the tuning numbers specified to the compiler.
	Used for debugging music without having to recompile. It
	takes effect immediately.

back	Rewinds the tape, if any.  In timesharing, dismisses to ID.
	Out of timesharing, restarts the timesharing system.

directory filename
	Prints all subfiles of file "filename".  If no name is given,
	prints all files on the tape.










                >>13<<c                                   Commands "load", "append", and  "play" may be  used to load  only
one section of a music file, or a part of one section. If, after all
subfile names are given, a number is typed, only that section number
will be loaded (sections are numbered starting with 1).  If a second
number is given, only that measure number and succeeding measures of
the  section will be  loaded.  This feature  is useful for debugging
specific sections of a piece of music.

   Both versions  may  be  stopped  in the  middle  of  playing  and
restarted at location 4.

   The controls on the amplifier on top of bay 7 may be adjusted for
volume and tone. In addition, the switches inside bay 10 can be used
to  switch parts from  one speaker to  the other, and  to change the
degree of filtering.

   WARNING - In timesharing as well as out, the music player  stores
music  on  drum  fields  used  by  Expensive  Typewriter  for  text.
Therefore, always  file the  text  of the  music on  Dectape  before
running the player.














































                >>13<<
                                

                               Frotz


   There  is a program to facilitate the task of preparing the input
text for the music compiler from a musical score.  It enables  notes
to  be inserted in Expensive  Typewriter's text buffer under control
of buttons and knobs.

   Frotz displays a staff with a note on it. The leftmost knob moves
the  note up and down.  The middle two knobs control the position of
the staff on the scope face.

   There is an overlay to  the button console which indicates  which
buttons correspond to the functions described below. Two buttons are
used to calibrate  the leftmost  knob, by forcing  the current  knob
position  to correspond  to the  top or  bottom of  the staff.  Five
buttons are  used  to  generate specifications  for  half,  quarter,
eighth, sixteenth, and thirty-second notes. Another button specifies
a dot.  Three buttons are  used for accidentals, four for  articula-
tion,  one for  rests.  Another  button generates  a slash, carriage
return, and  a  measure number>>40<<,  typed  corrections to  the  measure
number  will be reflected in subsequent measure numbers.  There is a
button to stop the display.

   "Underneath" Frotz is  an Expensive  Typewriter, and  all of  its
editing  features may be used.  Commands  may be typed in the normal
way>>40<<, the typewriter may also be used to enter music.

   Frotz is  still under  development, so  this description  may  be
inaccurate or incomplete by the time you read it.

   Frotz may be found on Dectape 0, under "frotz".
































                >>13<<f        
