|

| |
Logo Music Tools
by
Michael Tempel |
| |
 |
© 1992 Logo Foundation
|
You may copy and distribute this document for educational purposes
provided that you do not charge for such copies and that this copyright
notice is reproduced in full.
Acknowledgements
Thanks to Dorothy Fitch and Becque Olson for assistance and advice
in the preparation of these tools.
|
Logo Foundation
250 West 85th Street, Suite 4D
New York, NY 10024
Telephone: (212) 579-8028
FAX: (212) 579-8013
Board of Directors
Seymour Papert, Chair
Clotilde Fonseca
Tessa R. Harvey
Geraldine Kozberg
Michael Tempel
Takayuki Tsuru
The Logo Foundation is a nonprofit educational
organization incorporated in New York State.
|

Introduction
Many versions of Logo have a command that can produce sound. The
primitive note or tone produces a sound of a specified
pitch for a specified amount of time. (These tools were originally
developed using the Apple IIe version of LogoWriter. This documentation
is, therefore, written to that version. The tools have been adapted
for use with other versions of LogoWriter, Logo Ensemble, Apple
Logo II, LCSI Logo II, Object Logo, and Logo PLUS. They work in
pretty much the same way for all versions of Logo. The appendix
describes important differences.)
For example
tone 1000 60
tone 100 30
makes a high pitched tone for one second followed by a deeper tone
for half a second. You can create sound effects:
to jaws
repeat 15 [jaw]
end
to jaw
tone 50 10
tone 60 10
tone 40 10
tone 60 10
end
You can make music:
to row
tone 262 30
tone 262 30
tone 262 20
tone 294 10
tone 330 30
tone 330 20
tone 294 10
tone 330 20
tone 349 10
tone 392 60
end
Tone 262 30 produces a middle C for half a second.
Tone 440 60 generates an A above middle C for one second.
But writing music with repeated tone commands is tedious.
If you know about standard musical notation, you don't think about
262 and 30. You think about middle C and half notes; about andante
and allegro. These music tools will allow you to write tunes in
a way that more directly relates to musical notation.
Tempo Commands
The first thing you must do is determine the tempo at which music
will play using the command settempo.
settempo 60
establishes a tempo of 60 quarter notes per minute.
settempo 120
sets a tempo twice as fast; 120 quarter notes per minute.
There are also procedures that allow you to control tempo with
familiar words like andante and presto. Each has an
equivalent numeric tempo. Andante is the same as settempo
140. Here's the full list:
|
largo
larghetto
adagio
andante
allegro
presto
|
settempo 55
settempo 84
settempo 112
settempo 140
settempo 168
settempo 196
|
|
|
|
Once you've set a tempo it remains in effect until you give a
different tempo command. For example, you may say andante
(or its equivalent, settempo 140) and work on a tune. If
you later want to play the song at a quicker tempo, you might give
the command allegro. The tune will play faster the next time
you run the procedure that plays it. No changes to the procedure
itself are needed.
You may use any number as an input to settempo. Settempo
150 sets a tempo that is a bit faster than andante.
The reporter tempo tells you what the current tempo is.
For example:
settempo 60
show tempo
60
presto
show tempo
196
The tempo reporter also lets you change the tempo based
on whatever the current tempo is. For example
settempo 2 * tempo
doubles the tempo.
settempo 3 / 4 * tempo
slows the tempo to three fourths of what it is.
Procedures for Notes
Once you've set a tempo, you can play a tune with a procedure like
this:
to row.better
allegro
c3 h. c3 h. c3 h d3 q
e3 h.
e3 h d3 q e3 h f3 q g3
(h. + h.)
end
C3, d3, e3, f3, and g3 are the
names of notes. Q, h, and h. stand for quarter,
half, and three quarter (dotted half.) C3 h. means a three
quarter note c. D3 q is a quarter note d. E3 h is
a half note e.
There are five octaves of notes provided in these tools. The number
3 following the C and the D indicates that
they are in the third octave. D1 is in the lowest octave,
d5 is in the highest octave. There is no space between D and
3 because the name of the procedure is D3, a single Logo word.
Sharps are indicated with the # symbol. C#2 is C
sharp above middle C. Flats are indicated using the ! symbol.
D!2 is the D flat above middle C.
Each note procedure requires a duration input. This may be a number.
F#2 60
generates an F sharp above middle C for one second. But the input
may instead be one of the time value reporters included in the Music
Tools.
Time Value Reporters
The time value reporters are w, h, q, e,
and s, for whole, half, quarter, eighth, and sixteenth. So
F2 h produces an F above middle C for twice as long a duration
as f2 q
There are also procedures for "dotted" notes: s., e.,
q., and h.
F2 q. is a dotted quarter note f above middle c and f2
h. is a three quarter note f above middle c.
The procedure r is a rest. It takes the same inputs as the
notes do. R q is a quarter rest. R h. is a three quarter
rest.
Tied notes may be written by adding time values together. For example
g3 (q + h) r h
is a g played for a half note plus a quarter note - the same sound
as g3 h. - followed by a half rest. The parentheses aren't
needed, but they may make your music easier to read.
The actual number that is reported by each of the time value procedures
depends on the overall tempo that has been set by the settempo
command. If you don't set a tempo, you'll get an error message from
Logo because it won't be able to determine the actual values of
the time value reporters w, h, h., q,
q., e, e., s,
and s.
Using the Logo Music Tools
To use these tools you will need a suitable version of Logo and
the appropriate Logo Music Tools disk. The Music Tools for the various
versions of Logo are grouped by disk format, ProDOS, MSDOS, and
Macintosh. The ProDOS and MSDOS disks come in both 3.5" and 5.25"
sizes. Music Tools for several Logo versions are on the same disk.
Just ignore the ones you don't need.
For each version of Logo there is a file that contains the Music
Tools themselves, and another file with procedures that play a sample
song. Except where indicated, the name of the Music Tools file is
MUSIC and the sample song is TWINKLE.
The files are "locked" so as to prevent unintentional changes.
It is best to make a copy of the Music Tools disk and leave the
original as it is.
The details of how to get the tool procedures into memory are specific
to your version of Logo. Here are ways you may get the Music Tools
and, if you wish, the sample song, into memory:
ProDOS Disk
Apple Logo II and LCSI Logo II
load "logo2music
load "logo2twinkle
LogoWriter - Apple IIe version and LogoWriter Robotics
getpage "music
(or select the MUSIC page from CONTENTS)
load "twinkle
LogoWriter - Apple IIGS version
getpage "gsmusic
(or select the GSMUSIC page from CONTENTS)
load "gsletwinkle
LogoEnsemble
getpage "lemusic
(or select the LEMUSIC page from CONTENTS)
load "gsletwinkle
Logo PLUS
read "music
read "twinkle
MSDOS
LogoWriter and LogoWriter Robotics
getpage "music
(or select the MUSIC page from CONTENTS)
load "twinkle
PC Logo
load "music
load "twinkle
Macintosh
LogoWriter
getpage "music
(or select the MUSIC page from CONTENTS)
load "twinkle
Object Logo
load "music
load "twinkle
Apple Logo II, LCSI Logo II and Object Logo allow you to "bury"
procedures. You might want to have the Music Tools buried so that
they won't be saved along with any songs you are writing. Look at
your reference guide for information about how to do this.
A similar capability is provided in LogoWriter, LogoWriter Robotics
and LogoEnsemble with the command gettools. You might want
to gettools "music, instead of getpage "music. Again,
check your reference guide for details.
Appendix
Differences Between Versions of Logo
In most versions of Logo the sound producing command takes two
inputs. The first input is a number that determines the pitch in
cycles per second, or hertz. This is the same for all versions.
The second input determines the duration of the sound. The units
for this input vary from one version to the next.
The name of the sound making primitive also varies. This table
summarizes the differences:
|
Version of Logo
LogoWriter
Apple(including LogoWriter Robotics)
Macintosh
GS
MSDOS
Logo Ensemble
Logo PLUS
Apple Logo II
LCSI Logo II
PC Logo
|
Primitive Name
tone
tone
tone
tone
tone
note
toot
toot
tone
|
Units of the
Duration Input
60ths of a second
60ths of a second
20ths of a second
20ths of a second
10ths of a second
100ths of a second
60ths of a second
60ths of a second
100ths of a second
|
|
|
|
|
Object Logo has a three input primitive called toot. The
first input is frequency. The second input is amplitude, or volume,
in the range of 0 to 255. The third input is duration measured in
whole seconds. Fractional inputs are acceptable. The Music Tools
do not make any use of the second input. The note primitives all
sound at maximum volume. (You could modify these tools to take advantage
of this feature, implementing procedures such as forte and
piano.)
The Music Tools for each version of Logo have been written to take
account of version differences. In each case the appropriate name
of the sound-making primitive is used, and the procedures settempo
and tempo take account of the differences in the duration
input to that primitive. So, a song may be written the same way
for all versions for which these Music Tools are provided.
There are other important differences between versions of Logo.
Read the sections that apply to the one that you are using.
LogoEnsemble and LogoWriter for the Macintosh
E is the name of a primitive, so it can't be used. The name
for an eighth note is eth instead of e.
MSDOS LogoWriter
Tones run together so that
tone 440 20 tone 440
20
sounds the same as
tone 440 40
rather than sounding as two separate notes. The Music Tools for
MSDOS LogoWriter have been written to introduce a short wait at
the end of each note procedure. But if the tempo is fast, notes
with short durations may not sound at all.
All LogoWriter versions and LogoEnsemble
It is possible to set a tempo that is so slow that it causes an
error message such as
tone doesn't like
300 as input in c3
This results from having an input to tone that is too big
(above 255). This is especially a problem in LogoWriter for the
Apple II where the duration input to tone is 60ths of a second.
Apple IIGS Computers
The Apple IIGS has two speeds, Normal and Fast, which are set using
the Control Panel. LogoWriter GS and LogoEnsemble require the fast
setting. The other Apple II versions of Logo that may be used on
the Apple IIGS require the normal setting. The Music Tools will
work even if the setting isn't correct, but it sounds like a record
playing at the wrong speed.
|