home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 2: PC
/
frozenfish_august_1995.bin
/
bbs
/
d03xx
/
d0356.lha
/
AlgoRhythms
/
AlgoRhythms.Doc
< prev
next >
Wrap
Text File
|
1990-06-05
|
33KB
|
932 lines
AlgoRhythms User Manual
AlgoRhythms 1.0
Algorithmic Composition Software by Thomas E. Janzen
AlgoRhythms 1.0 software Copyright (c) 1990 Thomas E. Janzen
Thomas E. Janzen makes no warranties, either expressed or
implied, with respect to the software program recorded on the
diskette or the instructions, their quality, performance,
merchantability or fitness for any particular purpose. The
program and instructions are distributed free "as is". The entire
risk as to their quality and performance is with the user. In no
event will Thomas E. Janzen be liable for direct, indirect,
incidental or consequential damages resulting from any defect
in the program or instructions, even if Thomas E. Janzen has
been advised of the possibility of such damages.
This software may be redistributed only intact with no change and
only at no charge.
Your comments about AlgoRhythms are very welcome as soon as you
have tried the program. Your comments and questions about
AlgoRhythms may be directed to:
Thomas E. Janzen
35 Briarwood Lane #4
Marlborough, MA 01752
1 (508) 485-1657
Commodore (TM), Amiga (TM) are trademarks of Commodore Business
Machines, Inc. Lattice is a trademark of Lattice, Inc. MIDI is
specified by the International MIDI Association (IMA).
No part of this software may be used in whole or in part in
another public domain or commercial software. No music produced
by this program may be used for commercial purposes.
INTRODUCTION
Algorithmic composition software makes a computer into a
composer. Algorithmic composition is at least 35 years old,
first heard from LeJaren Hiller's Illiac Suite. Hiller's
computer program wrote music in batch mode and printed it out as
alpha-numeric characters, from which it was transcribed by hand
onto music paper for performance by a human string quartet. In
the 1960's, Greek composer Iannis Xenakis made many good modern
pieces in a very formal way, and a few times used a computer to
calculate the form of the piece, in a way closely related to the
way that AlgoRhythms does. An alphnumeric print-out was
transcribed for human players, as before. Many commercial
programs for algorithmic composition have appeared recently, and
usually develop melodic fragments to aid improvisation in pop
music. Some can play MIDI instruments directly, and in real
time. AlgoRhythms was written to avoid melodies and to avoid a
regular beat. The concept of sinusoidally-varying formal
parameters used by AlgoRhythms was developed in 1976 and used in
two of my manually written piano pieces: "Animations" (1977) and
"Lucy's Dance" (1982). Form files roughly reproducing these
works are available with other examples of forms in the forms
subdirectory . Although the Amiga Intuition interface makes
AlgoRhythms easy to use, the one disadvantage is that the user
needs to perform mental trigonometry.
In AlgoRhythms, the computer chooses the pitches, durations, and
dynamics (loudnesses) played to one MIDI channel so that a MIDI
instrument can play the music that the Amiga "improvises."
The user of the software chooses a shape for the piece. The
shape of the piece is determined by how the pitches, durations,
and dynamics slowly change with time while the music plays.
AlgoRhythms plays music in real time while it makes choices of
pitches, durations, and dynamics, and can run virtually
indefinitely.
This software does not read or save MIDI file-specification
files or any other score file. The files saved by this software
are merely the parameters of the overall form of the piece, which
are selected by the user. This program does not display the
music in musical notation, but in a graphical notation instead.
This program does not use the internal Amiga voices. It plays on
up to 16 MIDI channels at a given time. This program does not
receive MIDI data. It may be that incoming data would make it
crash. It is best not to have any incoming MIDI data. When the
music starts, a MIDI Start command is sent. When the music is
stopped by the Stop Command, a MIDI Stop command is sent. MIDI
clock commands are sent about 25 times a second regardless of
tempo, except when Pulse is set to zero (0), when no MIDI clocks
are sent.
AlgoRhythms was compiled with Lattice (TM) C 5.05.
HARDWARE REQUIREMENTS
AlgoRhythms probably would run on an Amiga with 512K bytes of
memory. It was developed on a two mega-byte Amiga 500 with an
ECE (TM) MIDI adaptor. The serial port is used to send MIDI
data. Therefore a MIDI interface is required on the serial port.
A MIDI synthesizer must be connected to the MIDI interface.
AlgoRhythms does not use internal Amiga voices.
RUNNING ALGORHYTHMS
To run AlgoRhythms, click the right mouse button twice on the
AlgoRhythms drawer, then click twice on the AlgoRhythms project
icon. AlgoRhythms will create a window with a four-menu-strip
menu, and draw a randomized starting form for the music. The
beginning duration of the piece is ten minutes. The form that
AlgoRhythms begins with is randomized, that is, pseudo-random
numbers were used to select the periods and phases of the
parameters, of which more later. The shape of the randomized
form is drawn after AlgoRhythms is started. If you wish, you may
play this randomized piece by selecting the Play menu item.
USING ALGORHYTHMS
The AlgoRhythms window is a Workbench window that can be re-
sized. When the window is re-sized using the sizing gadget with
the mouse, the graphical form curves are refreshed in the new
proportions. If the close gadget is used, all playing activity
is stopped and the program terminates. The front-to-back gadget
works normally. The drag gadget is useful for moving the window
if it is small enough to move inside the screen.
THE ALGORHYTHMS MENU
There are three menu strips in the AlgoRhythms menu. All of the
menu selections are available whether or not music is playing.
If they were all visible at once, they would look a little like
this:
Projects Form Scales Voices
Play A-P Max Voices A-V Chromatic Voice 0
Stop A-S ReDraw A-R Short Pentatonic Voice 1
Continue A-C Pulse A-N hira joshi Voice 2
Load A-L Duration A-D kumoi joshi Voice 3
Save A-F Pitch kokin joshi Voice 4
About A-A Rhythm Whole Tone Voice 5
Quit A-Q Dynamics Diatonic Voice 6
Texture Harmonic Minor Voice 7
Note Length Hungarian Minor Voice 8
Diminished Voice 9
Long Pentatonic Voice 10
Transposition A-T Voice 11
Voice 12
Voice 13
Voice 14
Voice 15
In addition, some Form menu strip items have sub menus. Pitch,
Rhythm, and Dynamics have the following sub-menu:
Mean Period
Mean Phase
Spread Period
Spread Phase
Randomize
Texture has the sub-menu:
Spread Period
Spread Phase
Randomize
The Note Length item has the sub-menu:
Minimum
Maximum
The Projects Menu
Play A-P
If you select the Play function with the mouse or by hitting the
Right Amiga key and the "P" key, the music will start playing via
the serial port. In addition, a line will be drawn along the
Pitch curve to show time passing as the piece progresses.
Before starting to play, AlgoRhythms sends a MIDI Start command.
This is useful for recording AlgoRhythms with a MIDI sequencer.
Notes are played with the MIDI Note On command. Before a new
note is sent out to an AlgoRhythms voice, a Note Off command is
sent to stop the previous note. MIDI clock commands are sent
about 25 times a second regardless of the setting of Pulse.
Stop A-S
If you select the Stop function with the mouse or by hitting the
Right Amiga key and the "S" key, the music will stop playing if
it had been playing. MIDI Note Off commands are sent to notes
that were on when you activated the Stop function. After all
notes are stopped, a MIDI Stop command is sent.
Continue A-C
If you select the Continue function with the mouse or by hitting
the Right Amiga key and the "C" key, the music will continue in
the graph where it left off when you hit "Stop." A MIDI Continue
command will be sent.
Load A-L
If you select the Load function with the mouse or by hitting the
Right Amiga key and the "L" key, a requester will appear with a
string gadget for you to enter the name of a form file to load.
AlgoRhythms does not read or write SMUS files, MIDI files, or any
other score file. AlgoRhythms files are summaries of the form or
shape of the piece selected in the Form and Scales menu strips.
Because form files are text files, you can edit them in a text
editor and load them, but they must be in the exact form below.
Form files may not have comments. The comments below are
tutorial.
600.00 -- duration of the piece, in seconds
0.0 -- minimum duration for any note
2.0 -- maximum duration for any note
13 -- number of notes in the scale
48 -- the MIDI note numbers of the scale pitches
50
53
55
58
60
62
65
67
70
72
74
77
16 -- maximum number of voices playing at once
10 -- pulses per second
200.00 Pitch form -- Mean period in seconds
-1.57 -- starting phase of mean in radians
200.00 -- Spread period in seconds
-1.57 -- Spread starting phase in radians
200.00 Rhythm form -- Mean period in seconds
1.57 -- starting phase of mean in radians
200.00 -- Spread period in seconds
-1.57 -- spread starting phase in radians
200.00 Dynamics form -- Mean period in seconds
-1.57 -- starting phase of mean in radian
200.00 -- Spread period in seconds
-1.57 -- spread starting phase in radians
200.00 Texture form -- Spread period in seconds
-1.57 -- starting phase of spread in radians
24 96 0 1 Low Pitch, High Pitch, MIDI Channel, Walking
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
24 96 0 1
The last sixteen lines give the lowest pitch, highest pitch, MIDI
channel (of 0 to 15) and walking (walking=1; not walking=0) for
each of the 16 AlgoRhythms voices. These can be changed while
the program is running. The lowest pitch is the lowest pitch
allowed in the voice. This helps you avoid having AlgoRhythms
play pitches that do not sound good for a particular sample, for
example. If the voice is walking up and down the scale, it will
turn around at the lowest pitch and highest pitch and head back
towards the middle of the range of the instrument. If the voice
is playing random notes, It will simply not play notes that are
out of range, defined by the lowest note and highest note.
Loading edited files affords the opportunity of loading scales
other than the scales in the scales menu. Transposition works on
imported scales.
If you select the Load function and the file does not exist, the
screen will flash and a tone will beep. The form will not
change.
There are several example form files in the forms subdirectry.
AlgoRhythms/Forms/
animations.form arctan.form
circle.form cosine.form
fastwalk.form loud.form
lucy.form mean.form
normdist.form range.form
sine.form stddev.form
tan.form tests.form
variance.form Gamelan.form
The names of the form files have no special meaning, except that
Animations.form and Lucy.form represent recreations of the
original works to use the formal techniques used in AlgoRhythms.
Save A-F
If you select the Save function with the mouse or by hitting the
Right Amiga key and the "F" key, a requester with a string gadget
will appear into which you may type a file name for saving the
form file, described above. A name similar to "file.form" is
recommended.
About A-A
If you select the About function with the mouse or by hitting the
Right Amiga key and the "A" key, you will see a copyright notice
for AlgoRhythms.
Quit A-Q
If you select the Quit function with the mouse or by hitting the
Right Amiga key and the "Q" key, or hit the window close gadget,
the music will stop and AlgoRhythms will exit.
Form Menu
Max Voices A-V
If you select the Max Voices function with the mouse or by
hitting the Right Amiga key and the "V" key, a requester with a
string gadget will appear into which you can type a number from 1
to 16 for the maximum number of voices to be playing, when the
waveform for Texture is at its peak. Voice 0 always plays. The
low-numbered AlgoRhythms voices have precedence. If you specify
three voices, voices 0, 1, and 2 play, for example.
ReDraw A-R
If you select the ReDraw function with the mouse or by hitting
the Right Amiga key and the "R" key, the graphical representation
of the form of the music will be refreshed in the AlgoRhythms
window. This is useful for showing the new form after Form
parameters have been changed.
Pulse A-N
If you select the Pulse function with the mouse or by hitting the
Right Amiga key and the "N" key, a requester with a string gadget
will appear into which you can type the number of pulses per
second that the music should have. Values from 5 to 12 make a
real difference. Numbers over 20 have little effect. Numbers
over 25 would have no effect at all. Entering a zero would
eliminate quantization, and the rhythm would be very fluid. The
actual tempo lags behind the pulse setting somewhat, but this has
not been characterized. Casual measurements give 6 pulses per
second when 8 is chosen, and higher values seem to lag to an even
greater extent. MIDI Timing Clocks are sent about 25 times a
second regardless of tempo unless Pulse is set to zero, in which
case no Timing Clocks are sent.
Duration A-D
If you select the Duration function with the mouse or by hitting
the Right Amiga key and the "D" key, a requester with a string
gadget will appear allowing you to enter a duration, in seconds,
for the piece of music. After the music plays for this duration,
the music stops. You may set any length from zero up.
Pitch
If you select the Pitch function with the mouse, you will
activate the Pitch sub-menu. This sub-menu is the heart of the
form-controlling technique used by AlgoRhythms, and is used for
Rhythm and Dynamics as well. The menu items are:
Mean Period
Mean Phase
Spread Period
Spread Phase
Randomize
The "Periods" of the Mean and Spread are in seconds. The phases
are angles.
Mean Period
The Mean Period is the period of the sine-wave oscillation
of the rough mean value. For the Pitch menu-item, Mean Period is
the length of the cycle through which the mean value for pitch
moves. A sine-wave moves up and down gradually with time:
** **
* * * *
* * * *
** **
The wave is shown with phase zero. Here is a sine-wave with
different phases, in radians:
1 * pi radians:
**
* * *
* * *
** **
.5 * pi radians:
* **
* * *
* * *
** **
-0.5 * pi radians:
**
* *
* *
* **
There are 2 * pi (6.28...) radians in a circle. 1 * pi
(3.14159...) radians is a semi-circle. The proportional gadget
for entering phase is a horizontal slider. Zero phase is in the
center. Pi radians (half circle) is all the way to the right and
minus Pi radians is all the way to the left.
If you enter a period of 180 seconds, it will take the mean pitch
three minutes to move all the way up and down the range of the
scale before returning to the beginning phase. If you enter
10000 seconds for the period, the mean pitch will virtually not
change at all. Sometimes you will want a form parameter to
remain at one value; this is the way to do it.
The equation for pitch without any spread is:
pitchpoint = sin( 2 * pi * time / period + phase)
pitch_index= (pitchpoint + 1) * scale_range
pitch=scale(pitch_index)
Spread gives a range from which the pitch is chosen using random
numbers. Any pitch in the range set by the spread is allowed.
Like mean values, spread has a period and starting phase. When
spread is high, any pitch within the scale could be used (if mean
is in the middle of the scale). When spread is low, you will
hear a repeated pitch resulting from only the pitch mean and
phase.
If you use the walking option, none of the Pitch form parameters
affect the music at all.
Let's say that you set the periods of mean pitch and pitch spread
to be the same, perhaps 120 seconds (two minutes), and you set
the starting phase of the mean pitch to be zero, and the starting
phase of the pitch spread to be zero, the separate waveforms
could look like this:
Mean Pitch:
120"
**
* * *
* * *
**
Pitch Spread:
**
* * *
* * *
**
In the graphical representation on the AlgoRhythms window, the
pitch form would be respresented like this:
**
***** *
* ** * **
**
This form makes the piece begin with pitches in the middle of the
scale, and gradually raise in average pitch, while at the same
time using a wider and wider range of pitches, until 30 seconds
into the piece when the whole top of the scale is being used.
Then the mean pitch falls until 1:30 into the piece when it plays
only a few very low pitches.
If you use the Randomize sub-item, the parameter will be
randomized. Use ReDraw to see what values were chosen. The two
periods will be about a couple minutes long, and the two phases
could be anything from -pi to +pi.
Rhythm
If you select the Rhythm function with the mouse, you will
activate the Rhythm sub-menu. The Rhythm sub-menu works exactly
like the Pitch sub-menu. Note that the unit is time. The higher
the Rhythm graph is, the longer the notes are, and the slower the
music is. The wider the Rhythm graph, the greater variety of
durations. If the Rhythm graph is narrow, the beat is more
regular.
Dynamics
If you select the Dynamics function with the mouse, you will
activate the Dynamics sub-menu. Dynamics form works exactly like
Pitch form and Rhythm form. The higher the graph, the louder the
music. The wider the curve, the greater variety of loudnesses
will be heard. A variety of dynamics tends to sound more human
and rhythmic, as opposed to a single loudness level, which sounds
mechanical.
Texture
If you select the Texture function with the mouse, you will
activate the Texture sub-menu. Texture form does not have a
mean, it has only spread period and spread phase. As the spread
of the texture graph is greater, more voices (up to Max Voices)
play. Voice priority is from voice zero up. That is, voice 0
always plays, so the MIDI channel assigned to voice 0 always
plays. Voice one is selected next, two after that, and so on.
Note Length
If you select the Note Length menu item with the mouse, you will
activate the Note Length sub-menu. Use the mouse to select the
either "Minimum" or "Maximum" from the sub-menu. Type a length
of time in seconds into the string gadget in the requester to set
the mininum length of time a note may last or the maximum length
of time a note may last. The random duration of a note is chosen
in the range set by the minimum and maximum note length. The
purpose of this was to allow synthesizer voices with long attacks
to speak fully before ending, even if the rhythm form specified
short notes. Setting the minimum note length to a few seconds
and the maximum note length to something longer allows you to
make slow music with long gentle attacks, decays, and releases.
Scales Menu
If you select a scale in the Scales menu, that scale immediately
takes effect in the music. The long scales range from MIDI pitch
24 to just below 108. The short scales range about a fifth below
middle C to about a twelfth above middle C. If you need more
detail about these scales, see the Scales.c source code in the
AlgoRhythms/source/ subdirectory. Note that you can create new
scales by editing them (as MIDI note numbers) into a form file
and loading the form file. See the section above on form file
format.
Chromatic
This long scale is a chromatic scale of over six octaves
from MIDI 24 to 107.
Short Pentatonic
This short scale is a pentatonic scale from the C below
middle-C to the F an eleventh above middle-C, including C, D, F,
G, B-flat.
hira joshi
kumoi joshi
kokin joshi
These short scales are tunings of the classical Japanese
instruments, the koto.
Whole Tone
This long scale is a long scale including only C, D, E, F#,
G#, A#.
Diatonic
This long scale is the white keys of the piano, which
corresponds to C-major.
Harmonic Minor
This long scale, in C, consists of C, D, E-flat, F, G, A-
flat, B.
Hungarian Minor
This long scale, in C, consists of C, D, E-flat, F#, G, A-
flat, B.
Diminished
This long scale consists of C, D, E-flat, F, F#, G#, A, B.
Long Pentatonic
This long scale consists of C, D, F, G, B-flat.
Transposition A-T
If you select the Transposition item with the mouse or by
hitting the Right-Amiga key and the "T" key, a requester with a
string gadget will appear, permitting you to enter the number of
half-steps to transpose the scale. This takes effect
immediately. For example, if AlgoRhythms is playing in the
diatonic scale, and you use Tranposition to tranpose the scale by
+3 steps, the new scale will correspond to E-flat major instead
of C-major.
Voices Menu
When you select the Voices menu, you see 16 voices, 0
through 15. These are AlgoRhythms voices, not voices on your
synthesizer. Selecting a channel number for each voice activates
a requester that permits set-up for a voice:
High Note
____C7_______
Low Note
____C1_______
Channel
____0________
Voice Parameters
Cancel | Walking | OK
"High Note" and "Low Note" define the range allowed in the voice.
As explained before, a voice will not play out-of-range notes in
random mode, and turns back from range boundaries in walk mode.
Note that, in random notes (non-walking) mode, if your current
scale has a broader range than the AlgoRhythms voices (set with
High Note and Low Note), AlgoRhythms may go silent because it is
selecting notes that are out of range for the voices. This is
likely to happen when the pitch curve is very thin and very high.
In such an instance, wait a minute for the music to return.
Otherwise, stop and re-arrange parameters and ranges to avoid
this situation. Click the right mouse button over the String
Gadget for High Note or Low Note, and type in the note and
octave, for example:
C7, C#7, Db6, Ab5 are note names suitable for High Note.
c0, C#1, eb2, G#3, Fb3 are suitable for Low Note.
Note that C4 is middle C (ca. 261 Hz) and that the flat sign is
just a 'b' or 'B' (bravo), and the sharp sign is a pound sign.
In the integer gadget used for channel number, you may enter the
MIDI channel you want that voice to play to. This permits
separate voices to play on separate synthesizer sounds. Only the
number of voices 0 to max_voices-1 (selected in the Forms menu)
will play. If you wish to hear all the voices when different
channels are assigned, use "OMNI ON" on your synthesizer. Any
AlgoRhythms voice may be set to any MIDI channel. Two different
voices may be set to the same MIDI channel. When AlgoRhythms
starts, all voices are assigned to MIDI channel 0 (of 0 to 15, or
channel 1 of 1 to 16).
If you select the Walking item with the mouse, the voice
will toggle back and forth between playing random notes in the
scale, or playing notes adjacent to the last note played in each
voice. A mathematical random walk allows a drunk to take any
sized step in any direction. AlgoRhythms uses a walk that can do
three things: it can go up a step, down a step, or not move.
When the walk comes to a voice's Low Note or High Note, it turns
back in the other direction. A walking voice completely
disregards the Pitch form curve.
Graphic output
AlgoRhythms draws a graphic representation of the shape or form
of the piece to be played. In the drawing there are four
waveforms labeled "Pitch," "Rhythm," "Dynamics," and "Texture."
As the music plays, you will see a time line move across the
Pitch curve. Note the following:
The higher the pitch curve, the higher the pitch (unless
walking).
The thicker the pitch curve, the wider the range playing (within
the voice's range).
The higher the Rhythm curve, the slower the music plays.
The thicker the Rhythm curve, the less regular the music is.
The higher the Dynamic curve, the louder the music.
The thicker the Dynamic curve, the more variety in dynamics,
i.e., the more accented the music sounds.
The thicker the Texture curve, the more voices play, to
max_voice.
Getting Good Music from AlgoRhythms
It is possible for AlgoRhythms to produce music which is fairly
pretty, and even somewhat human-like. The music can sound as
though someone is idly improvising with no pretense to melodic
development. The music can sound pretty due to the "windchime
effect." Windchimes with a pretty scale will produce euphony
regardless of how the wind hits the chimes. The prettiest scales
in AlgoRhythms are the Pentatonic scales and the hira joshi
scale. In addition, by using the "walking" pitch selection, the
pitches roam up and down the scale, sounding vaguely melodic.
Using the Short_Pentatonic scale with walking pitch selection can
produce surprisingly human results. Wider spreads of dynamics
also sound more accented and rhythmic.
The whole-tone scale is also fairly pretty regardless of what is
played. This scale was common in French Impressionism,
especially in works of Debussy.
Because voice number zero has precedence, it amounts to the solo
voice. The other voices function usually as accompaniment, at
times overtaking the solo. Therefore, if you use multiple
synthesizer voices, you may wish to assign voice zero to a
soloist voice, such as a saxophone, trumpet, clarinet, or
electric guitar. The middle voices (remember that you a limited
by how you set max_voice) could be accompaniment instruments such
as guitar, piano, and even drums. The last voices (close to
max_voice) could be unusual voices that add surprising colors
once in a while, because they only play when the texture curve is
very thick.
The sinusoid form curves used by AlgoRhythms were developed for
controlling musical form by the author in 1976. The purpose was
to answer the question: how can music be organized if there are
no high-Q, narrow-bandwidth, musical pitches in the music? The
history of Western classical music has been the history of
organizing sound by pitch. Counterpoint, harmony and melodic
studies were the center of musical developement for hundreds of
years because the instruments used made clear pitches of narrow
bandwidth. What if we used instruments of low-Q, higher
bandwidth sounds? For example, filtered white noise, such as
ocean surf sounds, wind sounds, drum sounds, and so on, can not
be organized using either Bach's counterpoint, tonal harmony, or
Schoenberg's serial technique. (It took Boulez and Stockhausen
to try to arrange percussion sounds in a serial fashion.)
Nevertheless, such sounds can be high or low, fast or slow, and
loud or soft. I came on the idea of slowly changing the
character of the music by curves that created gradual changes
that never stayed in one character of music for very long. The
mean and range of pitch, pace, and dynamic, were graphed on paper
in 1976 almost exactly as AlgoRhythms graphs them. My musical
taste at the time called for fluid non-regular rhythm,
non-motivic wanderings, and gradually changing character of
music. The purpose of AlgoRhythms is to implement this approach
to organizing sound, even though, most of the time, it is used
with high-Q musical sounds from MIDI instruments.
STRUCTURE OF ALGORHYTHMS
AlgoRhythms was my first large C program (about 2800 lines), and
it suffers from that distinction. Nevertheless, I will outline
the structure for those who want to understand it.
There are several source files for the AlgoRhythms program.
AlgoRhythms.c and AlgoRhythms.h
Scales.c and Scales.h
Window.c and Window.h
Menus.c and Menus.h
Gadgets.c and Gadgets.h
DrawForm.c and DrawForm.h
MIDIserial.c and MIDIserial.h
MusicTimer.c and MusicTimer.h
AlgoRhythms.c contains the code with most of the meat in it.
It manages the work performed by the other modules. It contains
the routine MakeEvent, which selects the exact pitch, duration,
and dynamic to use when playing the next note event. It contains
the musical structures, Events (the list of notes currently
playing), and the form structures, Pitch_Form, Duration_Form,
Dynamics_Form, and Texture_Form. The form structures contain
the selections made on the menus or brought in from the form
file. They include the four parameters mean period, mean phase,
spread period and spread phase described above. Texture_Form has
all four members, but only spread period and spread phase are
used to determine how many voices should be playing.
Scales.c holds the available musical scales, and permits
transposition of the current scale into any key. Other scales
can be used in the program by editing them into a form file and
loading the file into the program.
Window.c contains set-up and management code for the window.
Menus.c contains the menu structures and menu decoder, but does
not take any action on menu events. Action on menu events is all
taken in AlgoRhythms.c.
Gadgets.c produces the requester and gadget for string input, a
sliding gadget for phase input, and the Voice Parameter
requester.
DrawForm.c draws or refreshes the graphical representation of the
music to be played, and draws the time indicator.
MIDIserial.c opens the serial device at the MIDI baud rate,
writes MIDI note-on and note-off commands to the serial device,
and closes it at the end of the program.
MusicTimer.c opens the timer device and provides AlgoRhythms with
the current time. Time in AlgoRhythms is measured in a double
(floating-point) number of seconds, with microseconds. It was
intended to avoid quantized musical time, in preference for fluid
time without a beat. Probably an integer representation would
have served just as well. In fact, musical time is quantized by
the "pulse" selection anyway, in twenty-fifths of a second, but
this can be over-ridden by selecting a zero value for "pulse."
BIBLIOGRAPHY
Bolognesi, T. 1983. "Automatic Composition: Experiments with
Self-Similar Music." Computer Music Journal 7(1):25-36
Janzen, Thomas E. "Categories of Aesthetic Appeal in Computer
Music." M.I.T. Computer Music Journal 10(3), included in On the
Wires of Our Nerves Heifetz, ed., Buchnell U. Press 1989
Myhill, John. 1979. "Controlled Indeterminacy: A First Step
Toward a Semistochastic Music Language." M.I.T. Computer Music
Journal 3(3). Included in Foundations of Computer Music, Roads
and Strawn, ed. M.I.T. Press, Cambridge, 1985.
Xenakis, I. 1971. Formalized Music. Bloomington: Indiana
University Press.
Thanks to Len Fehskens for performing initial test and offering
practical suggetions, resulting in many improvements and
features.
APPENDIX
Note Names and MIDI Numbers
MIDI Pitch Frequency
12 C 0 16.35
13 C#0 17.32
14 D 0 18.35
15 D#0 19.45
16 E 0 20.60
17 F 0 21.83
18 F#0 23.12
19 G 0 24.50
20 G#0 25.96
21 A 0 27.50
22 A#0 29.14
23 B 0 30.87
24 C 1 32.70
25 C#1 34.65
26 D 1 36.71
27 D#1 38.89
28 E 1 41.20
29 F 1 43.65
30 F#1 46.25
31 G 1 49.00
32 G#1 51.91
33 A 1 55.00
34 A#1 58.27
35 B 1 61.74
36 C 2 65.41
37 C#2 69.30
38 D 2 73.42
39 D#2 77.78
40 E 2 82.41
41 F 2 87.31
42 F#2 92.50
43 G 2 98.00
44 G#2 103.83
45 A 2 110.00
46 A#2 116.54
47 B 2 123.47
48 C 3 130.81
49 C#3 138.59
50 D 3 146.83
51 D#3 155.56
52 E 3 164.81
53 F 3 174.61
54 F#3 185.00
55 G 3 196.00
56 G#3 207.65
57 A 3 220.00
58 A#3 233.08
59 B 3 246.94
60 C 4 261.63
61 C#4 277.18
62 D 4 293.66
63 D#4 311.13
64 E 4 329.63
65 F 4 349.23
66 F#4 369.99
67 G 4 392.00
68 G#4 415.30
69 A 4 440.00
70 A#4 466.16
71 B 4 493.88
72 C 5 523.25
73 C#5 554.37
74 D 5 587.33
75 D#5 622.25
76 E 5 659.26
77 F 5 698.46
78 F#5 739.99
79 G 5 783.99
80 G#5 830.61
81 A 5 880.00
82 A#5 932.33
83 B 5 987.77
84 C 6 1046.50
85 C#6 1108.73
86 D 6 1174.66
87 D#6 1244.51
88 E 6 1318.51
89 F 6 1396.91
90 F#6 1479.98
91 G 6 1567.98
92 G#6 1661.22
93 A 6 1760.00
94 A#6 1864.66
95 B 6 1975.53
96 C 7 2093.00
97 C#7 2217.46
98 D 7 2349.32
99 D#7 2489.02
100 E 7 2637.02
101 F 7 2793.83
102 F#7 2959.96
103 G 7 3135.96
104 G#7 3322.44
105 A 7 3520.00
106 A#7 3729.31
107 B 7 3951.07
108 C 8 4186.01
109 C#8 4434.92
110 D 8 4698.64
111 D#8 4978.03
112 E 8 5274.04
113 F 8 5587.65
114 F#8 5919.91
115 G 8 6271.93
116 G#8 6644.88
117 A 8 7040.00
118 A#8 7458.62
119 B 8 7902.13
120 C 9 8372.02
121 C#9 8869.85
122 D 9 9397.27
123 D#9 9956.06
124 E 9 10548.08
125 F 9 11175.30
126 F#9 11839.82
127 G 9 12543.86