home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 611.lha / AlgoRhythms_v2.0 / AlgoRhythms.Doc.pp / AlgoRhythms.Doc
Encoding:
Text File  |  1992-03-08  |  39.0 KB  |  1,104 lines

  1.  
  2. AlgoRhythms User Manual
  3.  
  4. AlgoRhythms 2.0
  5.  
  6. Algorithmic Composition Software by Thomas E. Janzen
  7.  
  8. AlgoRhythms 2.0 Copyright (c) 1990, 1991, 1992 Thomas E. Janzen
  9.  
  10. 1-1-1992
  11.  
  12. Thomas E. Janzen makes no warranties, either expressed or
  13. implied, with respect to the software program recorded on the
  14. diskette or the instructions, their quality, performance,
  15. merchantability or fitness for any particular purpose. The
  16. program and instructions are distributed free "as is". The entire
  17. risk as to their quality and performance is with the user. In no
  18. event will Thomas E. Janzen be liable for direct, indirect,
  19. incidental or consequential damages resulting from any defect
  20. in the program or instructions, even if Thomas E. Janzen has
  21. been advised of the possibility of such damages.
  22.  
  23. This software may be redistributed only intact with no change and
  24. only at no charge.
  25.  
  26. Your comments about AlgoRhythms are very welcome as soon as you
  27. have tried the program.  Your comments and questions about
  28. AlgoRhythms may be directed to:
  29.  
  30. Thomas E. Janzen
  31. 58A School Street Apt. 2-L
  32. Hudson, MA  01749-2518
  33. 1 (508) 562-1295
  34.  
  35. Commodore (TM), Amiga (TM) are trademarks of Commodore Business
  36. Machines, Inc.  MIDI is specified by the International MIDI
  37. Association (IMA).
  38.  
  39. No part of this software may be used in whole or in part in
  40. other public domain or commercial software.  No music produced
  41. by this program may be used for commercial purposes.
  42.  
  43. INTRODUCTION
  44.  
  45. Algorithmic composition software makes a computer into a
  46. composer.  Algorithmic composition is at least 35 years old,
  47. first heard from LeJaren Hiller's Illiac Suite.  Hiller's
  48. computer program wrote music in batch mode and printed it out as
  49. alpha-numeric characters, from which it was transcribed by hand
  50. onto music paper for performance by a human string quartet. In
  51. the 1960's, Greek composer Iannis Xenakis made many good modern
  52. pieces in a very formal way, and a few times used a computer to
  53. calculate the form of the piece, in a way closely related to the
  54. way that AlgoRhythms does.  An alphnumeric print-out was
  55. transcribed for human players, as before.  Many commercial
  56. programs for algorithmic composition have appeared recently, and
  57. usually develop melodic fragments to aid improvisation in pop
  58. music.  Some can play MIDI instruments directly, and in real
  59. time.  AlgoRhythms was written to avoid melodies and to avoid a
  60. regular beat.  The concept of sinusoidally-varying formal
  61. parameters used by AlgoRhythms was developed in 1976 and used in
  62. two of my manually written piano pieces: "Animations" (1977) and
  63. "Lucy's Dance" (1982).  Form files roughly reproducing these
  64. works are available with other examples  of forms in the forms
  65. subdirectory.
  66.  
  67. In AlgoRhythms, the computer chooses the pitches, durations, and
  68. dynamics (loudnesses) played to one MIDI channel so that a MIDI
  69. instrument can play the music that the Amiga "improvises."
  70. The user of the software chooses a shape for the piece.  The
  71. shape of the piece is determined by how the pitches, durations,
  72. and dynamics slowly change with time while the music plays.
  73. AlgoRhythms plays music in real time while it makes choices of
  74. pitches, durations, and dynamics.
  75.  
  76. The form files saved by this software are merely the parameters
  77. of the overall form of the piece, which are selected by the user. 
  78. This program does not display the music in musical notation, but
  79. in a graphical notation instead.  This program does not use the
  80. internal Amiga voices.  It plays on up to 20 MIDI channels at a
  81. given time.  This program does not receive MIDI data.  It may be
  82. that in-coming data would make it crash.  It is best not to have
  83. any incoming MIDI data.  When the music starts, a MIDI Start
  84. command is sent.  When the music is stopped by the Stop Command,
  85. a MIDI Stop command is sent.  MIDI clock commands are sent about
  86. 25 times a second regardless of tempo, except when Pulse is set
  87. to zero (0), when no MIDI clocks are sent.
  88.  
  89. AlgoRhythms was compiled with SAS/C.5.10b Compiler for AmigaDOS
  90. from SAS Institute, Inc.
  91.  
  92. HARDWARE REQUIREMENTS
  93.  
  94. AlgoRhythms probably would run on an Amiga with 512K bytes of
  95. memory.  It was developed on a three mega-byte Amiga 500 with an
  96. ECE (TM) MIDI adaptor.  The serial port is used to send MIDI
  97. data.  Therefore a MIDI interface is required on the serial port. 
  98. The serial device is not used in a shareable way by AlgoRhythms. 
  99. A MIDI synthesizer must be connected to the MIDI interface. 
  100. AlgoRhythms does not use internal Amiga voices.
  101.  
  102. Note that AlgoRhythms uses MIDI Running status.  This means that
  103. it sends out the MIDI channel (and Note On command) only when the
  104. channel changes, and when you use the Play and Continue commands. 
  105. Therefore, your synthesizer must be turned on and have the
  106. correct MIDI channel selected before you use the Play or Continue
  107. commands, for AlgoRhythms to drive the synthesizer.  If you
  108. forget to turn on your synth, just use the Stop and Continue
  109. commands, in that order.  This will send a new status to alert
  110. your synth, if it is on the correct MIDI channel.
  111.  
  112. RUNNING ALGORHYTHMS
  113.  
  114. To run AlgoRhythms, click the right mouse button twice on the
  115. AlgoRhythms drawer, then click twice on the AlgoRhythms project
  116. icon.  AlgoRhythms will create a window with a four-menu-strip
  117. menu, and draw a randomized starting form for the music.  The
  118. beginning duration of the piece is ten minutes.  The form that
  119. AlgoRhythms begins with is randomized, that is, pseudo-random
  120. numbers were used to select the periods and phases of the
  121. parameters, of which more later.  The shape of the randomized
  122. form is drawn after AlgoRhythms is started.  If you wish, you may
  123. play this randomized piece by selecting the Play menu item.
  124.  
  125. Colors
  126.  
  127. The file AlgoRhythms.Col should be in the same directory as
  128. AlgoRhythms.  If it is, AlgoRhythms will read it and use it to
  129. determine screen colors.  If the file is not present, default
  130. colors will be used.  This file can be edited in a text editor to
  131. make custom colors.  The format of the file is:
  132.  
  133. R0 R1 R2 R3 R4 R4 R5 R6 R7
  134. G0 G1 G2 G3 G4 G4 G5 G6 G7
  135. B0 B1 B2 B3 B4 B4 B5 B6 B7
  136.  
  137. R, G and B are for for red, green and blue for 8 color registers;
  138. the number are in decimal.  For example, the default colors
  139. currently: 
  140.  
  141. 4 15  12  7  8  15 0 15 
  142. 0 15  0   9 15  15 0  0 
  143. 4 15  0  15  0  15 0 15 
  144.  
  145. AlgoRhythmsCLI
  146.  
  147. AlgoRhythmsCLI has not been rebuilt for AlgoRhythms 2.0, plays
  148. only 16 voices, and at a lower rate than AlgoRhythms 2.0.
  149. AlgoRhythmsCLI is a CLI-only version of AlgoRhythms.  It enables
  150. you to run a script file under the command line interface that
  151. plays several forms in sequence without interruption or
  152. intervention.  To use this version, make the AlgoRhythms
  153. directory your default or add it to the paths, and type:
  154.  
  155. 1>AlgoRhythmsCLI /forms/Animations.form
  156.  
  157. This will play the Animations form in the forms subdirectory. 
  158. There is no way to stop AlgoRhythmsCLI once it has started
  159. without rebooting, so be certain of what you want before starting
  160. it.
  161.  
  162. USING ALGORHYTHMS
  163.  
  164. The AlgoRhythms window is a Workbench window that can be re-
  165. sized.  When the window is re-sized using the sizing gadget with
  166. the mouse, the graphical form curves are refreshed in the new
  167. proportions.  If the close gadget is used, all playing activity
  168. is stopped and the program terminates.  The front-to-back gadget
  169. works normally.  The drag gadget is useful for moving the window
  170. if it is small enough to move inside the screen.
  171.  
  172. THE ALGORHYTHMS MENU
  173.  
  174. There are three menu strips in the AlgoRhythms menu.  All of the
  175. menu selections are available whether or not music is playing. 
  176. If they were all visible at once, they would look a little like
  177. this:
  178.  
  179. Projects    Form        Scales            Voices
  180. Play    A-P    Max Voices A-V    TranspositionA-T    Voice 0
  181. Stop A-S    ReDraw    A-R    Chromatic        Voice 1
  182. Continue A-C    Pulse    A-N    Short Pentatonic    Voice 2
  183. Load Form A-L    Duration A-D    hira joshi        Voice 3
  184. Save Form A-F    Pitch        kumoi joshi        Voice 4
  185. Record A-I    Rhythm        kokin joshi        Voice 5
  186. Erase A-E    Dynamics    Whole Tone        Voice 6
  187. Save MIDI A-M    Texture        Diatonic        Voice 7
  188. About A-A     Note Length    Harmonic Minor        Voice 8
  189. Quit    A-Q            Hungarian Minor        Voice 9
  190.                 Diminished        Voice 10
  191.                 Long Pentatonic        Voice 11
  192.                 Mode 3            Voice 12
  193.                 Mode 4            Voice 13
  194.                 Mode 5            Voice 14
  195.                 Mode 6            Voice 15
  196.                 Mode 7            Voice 16
  197.                 m3 M2            Voice 17
  198.                 M3 m2            Voice 18
  199.                 Quartal            Voice 19
  200.                 Quintal
  201.  
  202. In addition, some Form menu strip items have sub menus.  Pitch,
  203. Rhythm, and Dynamics have the following sub-menu:
  204.  
  205. Mean Period
  206. Mean Phase
  207. Spread Period
  208. Spread Phase
  209. Randomize
  210.  
  211. Texture has the sub-menu:
  212.  
  213. Spread Period
  214. Spread Phase
  215. Randomize
  216.  
  217. The Note Length item has the sub-menu:
  218.  
  219. Minimum
  220. Maximum
  221.  
  222. The Projects Menu
  223.  
  224. Play A-P
  225.  
  226. If you select the Play function with the mouse or by hitting the
  227. Right Amiga key and the "P" key, the music will start playing via
  228. the serial port.  In addition, a line will be drawn along the
  229. Pitch curve to show time passing as the piece progresses.
  230. Before starting to play, AlgoRhythms sends a MIDI Start command.
  231. This is useful for recording AlgoRhythms with a MIDI sequencer. 
  232. Notes are played with the MIDI Note On command.  Before a new
  233. note is sent out to an AlgoRhythms voice, a Note Off command is
  234. sent to stop the previous note.  MIDI clock commands are sent
  235. about 25 times a second regardless of the setting of Pulse.
  236.  
  237. Stop A-S
  238.  
  239. If you select the Stop function with the mouse or by hitting the
  240. Right Amiga key and the "S" key, the music will stop playing if
  241. it had been playing.  MIDI Note Off commands are sent to notes
  242. that were on when you activated the Stop function.  After all
  243. notes are stopped, a MIDI Stop command is sent.
  244.  
  245. Continue A-C
  246.  
  247. If you select the Continue function with the mouse or by hitting
  248. the Right Amiga key and the "C" key, the music will continue in
  249. the graph where it left off when you hit "Stop."  A MIDI Continue
  250. command will be sent.
  251.  
  252. Load A-L
  253.  
  254. If you select the Load function with the mouse or by hitting the
  255. Right Amiga key and the "L" key, a file requester will appear. 
  256. If your libs: directory includes req.library from ReqLib by Colin
  257. Fox and Bruce Dawson (cf. AmigaLibDisk 400), a full file
  258. requester will appear; otherwise, a simple string gadget will
  259. appear.  If you do not have req.library, don't forget to list the
  260. forms subdirectory to see what forms have been provided. 
  261. AlgoRhythms does not read or write SMUS files or read MIDI
  262. files.  AlgoRhythms form files are summaries of the form or shape
  263. of the piece selected in the Form and Scales menu strips. 
  264. Because form files are text files, you can edit them in a text
  265. editor and load them, but they must be in the exact form below.
  266.  
  267. Form files may not have comments.  The comments below are
  268. tutorial.
  269.  
  270. 600.00    -- duration of the piece, in seconds
  271. 0.0        -- minimum duration for any note
  272. 2.0       -- maximum duration for any note
  273. 13        -- number of notes in the scale
  274. 48        -- the MIDI note numbers of the scale pitches
  275. 50
  276. 53
  277. 55
  278. 58
  279. 60
  280. 62
  281. 65
  282. 67
  283. 70
  284. 72
  285. 74
  286. 77
  287. 16        -- maximum number of voices playing at once
  288. 10        -- pulses per second
  289. 200.00    Pitch form -- Mean period in seconds
  290. -1.57        -- starting phase of mean in radians
  291. 200.00        -- Spread period in seconds
  292. -1.57        -- Spread starting phase in radians
  293. 200.00    Rhythm form -- Mean period in seconds
  294. 1.57            -- starting phase of mean in radians
  295. 200.00        -- Spread period in seconds
  296. -1.57        -- spread starting phase in radians
  297. 200.00    Dynamics form -- Mean period in seconds
  298. -1.57        -- starting phase of mean in radian
  299. 200.00        -- Spread period in seconds
  300. -1.57        -- spread starting phase in radians
  301. 200.00    Texture form -- Spread period in seconds
  302. -1.57        -- starting phase of spread in radians
  303. 24  96  0  1 Low Pitch, High Pitch, MIDI Channel, Walking
  304. 24  96  0  1
  305. 24  96  0  1
  306. 24  96  0  1
  307. 24  96  0  1
  308. 24  96  0  1
  309. 24  96  0  1
  310. 24  96  0  1
  311. 24  96  0  1
  312. 24  96  0  1
  313. 24  96  0  1
  314. 24  96  0  1
  315. 24  96  0  1
  316. 24  96  0  1
  317. 24  96  0  1
  318. 24  96  0  1
  319. 24  96  0  1
  320. 24  96  0  1
  321. 24  96  0  1
  322. 24  96  0  1
  323.  
  324. The last 20 lines give the lowest pitch, highest pitch, MIDI
  325. channel (of 0 to 15) and walking (walking=1; not walking=0) for
  326. each of the AlgoRhythms voices.  These can be changed while the
  327. program is running.  The lowest pitch is the lowest pitch
  328. allowed in the voice.  This helps you avoid having AlgoRhythms
  329. play pitches that do not sound good for a particular sample, for
  330. example.  If the voice is walking up and down the scale, it will
  331. turn around at the lowest pitch and highest pitch and head back
  332. towards the middle of the range of the instrument.  If the voice
  333. is playing random notes, It will simply not play notes that are
  334. out of range, defined by the lowest note and highest note.  The
  335. voice will rest for the duration of the out-of-range note.
  336.  
  337. Loading edited files affords the opportunity of loading scales
  338. other than the scales in the scales menu.  Transposition works on
  339. imported scales.
  340.  
  341. If you select the Load function and the file does not exist, the
  342. screen will flash and a tone will beep.  The form will not
  343. change.
  344.  
  345. There are several example form files in the forms subdirectry.
  346.  
  347. AlgoRhythms/Forms/
  348.  
  349.   animations.form                  arctan.form
  350.   circle.form                      cosine.form
  351.   fastwalk.form                    loud.form
  352.   lucy.form                        mean.form
  353.   normdist.form                    range.form
  354.   sine.form                        stddev.form
  355.   tan.form                         tests.form
  356.   variance.form                Gamelan.form
  357.  
  358. The names of the form files have no special meaning, except that
  359. Animations.form and Lucy.form represent recreations of the
  360. original works to use the formal techniques used in AlgoRhythms.
  361.  
  362. Save A-F
  363.  
  364. If you select the Save function with the mouse or by hitting the
  365. Right Amiga key and the "F" key, a file requester will appear
  366. into which you may type a file name for saving the form file,
  367. described above.  A name similar to "file.form" is recommended.
  368.  
  369. Record A-I
  370.  
  371. If you select the Record function with the mouse or by hitting
  372. the Right Amiga key and the "I" key, AlgoRhythms makes an
  373. internal recording of the note events of everything it plays.  It
  374. dynamically allocates memory until it runs out of memory, when it
  375. disables further recording.  
  376.  
  377. Erase A-E
  378.  
  379. Erase clears out the recording memory activated by the Record
  380. function, above.  It frees up memory in your Amiga for other
  381. applications or for more recording.
  382.  
  383. Save MIDI A-M
  384.  
  385. If you select the Save MIDI function with the mouse or by hitting
  386. the Right Amiga key and the "M" key, you can save a standard MIDI
  387. file of the recording made by AlgoRhythms of its own output. 
  388. This MIDI file can then be loaded into commercial MIDI software
  389. packages, such as sequencers, editors, and score printers.  If
  390. you have a score printing program, you could print an
  391. AlgoRhythms-created MIDI file, so that human performers could
  392. play the music composed by AlgoRhythms.  You will probably find,
  393. however, that in order to make a human-playable score with
  394. AlgoRhythms, you should use AlgoRhythms voice parameters to
  395. carefully limit the pitch range for each channel, separate the
  396. players by MIDI channel, and use a commercial sequencing program
  397. to quantize rhythms and line them up with measure bars.  
  398.  
  399. The MIDI files created by AlgoRhythms always use 240 ticks per
  400. quarter note, and a metronome marking of 60 quarters per minute. 
  401. This usually will not line up with the Pulse setting, so a good
  402. sequencer program is needed to expand/compress the note values
  403. to match a tempo marking before a neat score can be printed.  The
  404. file is a type 1 (multitrack) file with one track.  The track
  405. name is, roughly, "AlgoRhythms by Tom Janzen."  If you wish to
  406. print a score with separate staffs, you will have to assign a
  407. different MIDI channel to voices in AlgoRhythms, and separate the
  408. channels into different tracks in the MIDI sequencer.
  409.  
  410. About A-A
  411.  
  412. If you select the About function with the mouse or by hitting the
  413. Right Amiga key and the "A" key, you will see a copyright notice
  414. for AlgoRhythms.
  415.  
  416. Quit A-Q 
  417.  
  418. If you select the Quit function with the mouse or by hitting the
  419. Right Amiga key and the "Q" key, or hit the window close gadget,
  420. the music will stop and AlgoRhythms will exit.
  421.  
  422. Form Menu
  423.  
  424. Max Voices A-V
  425.  
  426. If you select the Max Voices function with the mouse or by
  427. hitting the Right Amiga key and the "V" key, a requester with a
  428. string gadget will appear into which you can type a number from 1
  429. to 20 for the maximum number of voices to be playing, when the
  430. waveform for Texture is at its peak.  Voice 0 always plays.  The
  431. low-numbered AlgoRhythms voices have precedence.  If you specify
  432. three voices, voices 0, 1, and 2 play, for example.
  433.  
  434. ReDraw A-R
  435.  
  436. If you select the ReDraw function with the mouse or by hitting
  437. the Right Amiga key and the "R" key, the graphical representation
  438. of the form of the music will be refreshed in the AlgoRhythms
  439. window.  This is useful for showing the new form after Form
  440. parameters have been changed.
  441.  
  442. Pulse A-N
  443.  
  444. If you select the Pulse function with the mouse or by hitting the
  445. Right Amiga key and the "N" key, a requester with a string gadget
  446. will appear into which you can type the number of pulses per
  447. second that the music should have.  Values from 5 to 12 make a
  448. real difference.  Numbers over 20 have little effect.  Numbers
  449. over 25 would have no effect at all.  Entering a zero would
  450. eliminate quantization, and the rhythm would be very fluid (also
  451. AlgoRhythms takes much more of the CPU resource from the
  452. operating system).  The actual tempo lags behind the pulse
  453. setting somewhat, but this has not been characterized.  Casual
  454. measurements give 6 pulses per second when 8 is chosen, and
  455. higher values seem to lag to an even greater extent.  MIDI Timing
  456. Clocks are sent about 25 times a second regardless of tempo
  457. unless Pulse is set to zero, in which case no Timing Clocks are
  458. sent.
  459.  
  460. Duration A-D
  461.  
  462. If you select the Duration function with the mouse or by hitting
  463. the Right Amiga key and the "D" key, a requester with a string
  464. gadget will appear allowing you to enter a duration, in seconds,
  465. for the piece of music.  After the music plays for this duration,
  466. the music stops.  You may set any length from zero up.
  467.  
  468. Pitch
  469.  
  470. If you select the Pitch function with the mouse, you will
  471. activate the Pitch sub-menu.  This sub-menu is the heart of the
  472. form-controlling technique used by AlgoRhythms, and is used for
  473. Rhythm and Dynamics as well.  The menu items are:
  474.  
  475. Mean Period
  476. Mean Phase
  477. Spread Period
  478. Spread Phase
  479. Randomize
  480.  
  481. The "Periods" of the Mean and Spread are in seconds.  The phases
  482. are angles.
  483.  
  484. Mean Period
  485.     The Mean Period is the period of the sine-wave oscillation
  486. of the rough mean value.  For the Pitch menu-item, Mean Period is
  487. the length of the cycle through which the mean value for pitch
  488. moves.  A sine-wave moves up and down gradually with time:
  489.  
  490.     **           **
  491.   *    *       *    *
  492. *       *    *       *
  493.           **           **
  494.  
  495. The wave is shown with phase zero.  Here is a sine-wave with
  496. different phases, in radians:
  497.  
  498. 1 * pi radians:
  499.  
  500.          **
  501. *      *    *
  502.  *   *       *
  503.   **           **
  504.  
  505. .5 * pi radians:
  506.  
  507. *           **
  508.   *       *    *
  509.     *    *       *
  510.       **           **
  511.  
  512. -0.5 * pi radians:
  513.  
  514.       **
  515.     *    *
  516.   *       *
  517. *           **
  518.  
  519. There are 2 * pi (6.28...) radians in a circle.  1 * pi
  520. (3.14159...) radians is a semi-circle.  The proportional gadget
  521. for entering phase is a horizontal slider.  Zero phase is in the
  522. center.  Pi radians (half circle) is all the way to the right and
  523. minus Pi radians is all the way to the left.
  524.  
  525. If you enter a period of 180 seconds, it will take the mean pitch
  526. three minutes to move all the way up and down the range of the
  527. scale before returning to the beginning phase.  If you enter
  528. 10000 seconds for the period, the mean pitch will virtually not
  529. change at all.  Sometimes you will want a form parameter to
  530. remain at one value; this is the way to do it.
  531.  
  532. The equation for pitch without any spread is:
  533.  
  534. pitchpoint = sin( 2 * pi * time / period  + phase)
  535.  
  536. pitch_index= (pitchpoint + 1) * scale_range
  537.  
  538. pitch=scale(pitch_index)
  539.  
  540. Spread gives a range from which the pitch is chosen using random
  541. numbers.  Any pitch in the range set by the spread is allowed.
  542. Like mean values, spread has a period and starting phase.  When
  543. spread is high, any pitch within the scale could be used (if mean
  544. is in the middle of the scale).  When spread is low, you will
  545. hear a repeated pitch resulting from only the pitch mean and
  546. phase.
  547.  
  548. If you use the walking option, none of the Pitch form parameters
  549. affect the music at all.
  550.  
  551. Let's say that you set the periods of mean pitch and pitch spread
  552. to be the same, perhaps 120 seconds (two minutes), and you set
  553. the starting phase of the mean pitch to be zero, and the starting
  554. phase of the pitch spread to be zero, the separate waveforms
  555. could look like this:
  556.  
  557. Mean Pitch:
  558.              120"
  559.     **          
  560.   *    *       *
  561. *       *    *  
  562.           **    
  563.  
  564. Pitch Spread:
  565.     **          
  566.   *    *       *
  567. *       *    *  
  568.           **    
  569.  
  570. In the graphical representation on the AlgoRhythms window, the
  571. pitch form would be respresented like this:
  572.  
  573.     **         
  574.   *****       *
  575. *   **  *    **
  576.          **   
  577.  
  578. This form makes the piece begin with pitches in the middle of the
  579. scale, and gradually raise in average pitch, while at the same
  580. time using a wider and wider range of pitches, until 30 seconds
  581. into the piece when the whole top of the scale is being used. 
  582. Then the mean pitch falls until 1:30 into the piece when it plays
  583. only a few very low pitches.
  584.  
  585. If you use the Randomize sub-item, the parameter will be
  586. randomized.  Use ReDraw to see what values were chosen.  The two
  587. periods will be about a couple minutes long, and the two phases
  588. could be anything from -pi to +pi.
  589.  
  590. Rhythm
  591.  
  592. If you select the Rhythm function with the mouse, you will
  593. activate the Rhythm sub-menu.  The Rhythm sub-menu works exactly
  594. like the Pitch sub-menu.  Note that the unit is time.  The higher
  595. the Rhythm graph is, the longer the notes are, and the slower the
  596. music is.  The wider the Rhythm graph, the greater variety of
  597. durations.  If the Rhythm graph is narrow, the beat is more
  598. regular, but the voices may not play together.  To get voices to
  599. play together, set the Pulse parameter (above).
  600.  
  601. Dynamics
  602.  
  603. If you select the Dynamics function with the mouse, you will
  604. activate the Dynamics sub-menu.  Dynamics form works exactly like
  605. Pitch form and Rhythm form.  The higher the graph, the louder the
  606. music.  The wider the curve, the greater variety of loudnesses
  607. will be heard.  A variety of dynamics tends to sound more human
  608. and rhythmic, as opposed to a single loudness level, which sounds
  609. mechanical.
  610.  
  611. Texture
  612.  
  613. If you select the Texture function with the mouse, you will
  614. activate the Texture sub-menu.  Texture form does not have a
  615. mean, it has only spread period and spread phase.  As the spread
  616. of the texture graph is greater, more voices (up to Max Voices)
  617. play.  Voice priority is from voice zero up.  That is, voice 0
  618. always plays, so the MIDI channel assigned to voice 0 always
  619. plays.  Voice one is selected next, two after that, and so on.
  620.     
  621. Note Length
  622.  
  623. If you select the Note Length menu item with the mouse, you will
  624. activate the Note Length sub-menu.  Use the mouse to select the
  625. either "Minimum" or "Maximum" from the sub-menu.  Type a length
  626. of time in seconds into the string gadget in the requester to set
  627. the mininum length of time a note may last or the maximum length
  628. of time a note may last.  The random duration of a note is chosen
  629. in the range set by the minimum and maximum note length.  The
  630. purpose of this was to allow synthesizer voices with long attacks
  631. to speak fully before ending, even if the rhythm form specified
  632. short notes.  Setting the minimum note length to a few seconds
  633. and the maximum note length to something longer allows you to
  634. make slow music with long gentle attacks, decays, and releases.
  635.  
  636. Scales Menu
  637.  
  638. If you select a scale in the Scales menu, that scale immediately
  639. takes effect in the music.  The long scales range from MIDI pitch
  640. 24 to just below 108.  The short scales range about a fifth below
  641. middle C to about a twelfth above middle C.  If you need more
  642. detail about these scales, see the Scales.c source code in the
  643. AlgoRhythms/source/ subdirectory.  Note that you can create new
  644. scales by editing them (as MIDI note numbers) into a form file
  645. and loading the form file.  See the section above on form file
  646. format.
  647.  
  648. Transposition A-T
  649.  
  650.     If you select the Transposition item with the mouse or by
  651. hitting the Right-Amiga key and the "T" key, a requester with a
  652. string gadget will appear, permitting you to enter the number of
  653. half-steps to transpose the scale.  This takes effect
  654. immediately.  For example, if AlgoRhythms is playing in the
  655. diatonic scale, and you use Tranposition to tranpose the scale by
  656. +3 steps, the new scale will correspond to E-flat major instead
  657. of C-major.
  658.  
  659. Chromatic
  660.     This long scale is a chromatic scale of over six octaves
  661. from MIDI 24 to 107.
  662.  
  663. Short Pentatonic
  664.     This short scale is a pentatonic scale from the C below
  665. middle-C to the F an eleventh above middle-C, including C, D, F,
  666. G, B-flat.
  667.  
  668. hira joshi
  669. kumoi joshi
  670. kokin joshi
  671.     These short scales are tunings of the classical Japanese
  672. instruments, the koto.
  673.  
  674. Whole Tone
  675.     This long scale is a long scale including only C, D, E, F#,
  676. G#, A#.
  677.  
  678. Diatonic
  679.     This long scale is the white keys of the piano, which
  680. corresponds to C-major.
  681.  
  682. Harmonic Minor
  683.     This long scale, in C, consists of C, D, E-flat, F, G, A-
  684. flat, B.
  685.  
  686. Hungarian Minor
  687.     This long scale, in C, consists of C, D, E-flat, F#, G, A-
  688. flat, B.
  689.  
  690. Diminished
  691.     This long scale consists of C, D, E-flat, F, F#, G#, A, B.
  692.  
  693. Long Pentatonic
  694.     This long scale consists of C, D, F, G, B-flat.
  695.  
  696. Mode 3
  697.     This is a long scale from Olivier Messiean's book "Technique
  698. of My Musical Language."  Messiean designates it as mode number
  699. 3.  The notes are C, D, Eb, E, F#, G, Ab, Bb, B.
  700.  
  701. Mode 4
  702.     This is another long scale from Olivier Messiean's book. 
  703. Messiean designates it as mode number 4.  The notes are C, Db, D,
  704. F, F#, G, Ab, B.
  705.  
  706. Mode 5
  707.     This is another long scale from Olivier Messiean's book. 
  708. Messiean designates it as mode number 5.  The notes are C, Db, F,
  709. Gb, F, B.
  710.  
  711. Mode 6
  712.     This is another long scale from Olivier Messiean's book. 
  713. Messiean designates it as mode number 4.  The notes are C, D, E,
  714. F F#, G#, A#, B.
  715.  
  716. Mode 7
  717.     This is another long scale from Olivier Messiean's book. 
  718. Messiean designates it as mode number 7.  The notes are C, Db, D,
  719. Eb, F, F#, G, F#, A, B.
  720.  
  721. m3 M2
  722.     This is a long scale from 24 to 96 that does not repeat each
  723. octave.  As it rises from note number 24, it alternates minor
  724. third, major second, minor third, major second, minor third,
  725. major second, and so on.
  726.  
  727. M3 m2
  728.     This is a long scale from 24 to under 96 that does not
  729. repeat each octave.  As it rises from note number 24, it
  730. alternates major third, minor second, major third, minor second,
  731. and so on.
  732.  
  733. Quartal
  734.     This is a long scale of all perfect fourths, rising, and
  735. does not repeat every octave of course.
  736.  
  737. Quintal
  738.     This is a long scale of all perfect fifths, rising, and does
  739. not repeat every octave, of course.
  740.  
  741. Voices Menu
  742.  
  743.     When you select the Voices menu, you see 20 voices, 0
  744. through 19.  These are AlgoRhythms voices, not voices on your
  745. synthesizer. Selecting a channel number for each voice activates
  746. a requester that permits set-up for a voice:
  747.  
  748. High Note         WALKING
  749. ____C7_______
  750. Low Note          CANCEL
  751. ____C1_______
  752. Channel          OK
  753. ____0________
  754.  
  755.     Voice Parameters
  756.  
  757. "High Note" and "Low Note" define the range allowed in the voice. 
  758. As explained before, a voice will not play out-of-range notes in
  759. random mode, and turns back from range boundaries in walk mode.
  760. Note that, in random notes (non-walking) mode, if your current
  761. scale has a broader range than the AlgoRhythms voices (set with
  762. High Note and Low Note), AlgoRhythms may go silent because it is
  763. selecting notes that are out of range for the voices.  This is
  764. likely to happen when the pitch curve is very thin and very high. 
  765. In such an instance, wait a minute for the music to return. 
  766. Otherwise, stop and re-arrange parameters and ranges to avoid
  767. this situation.  Click the right mouse button over the String
  768. Gadget for High Note or Low Note, and type in the note and
  769. octave, for example:
  770.  
  771. C7, C#7, Db6, Ab5 are note names suitable for High Note.
  772. c0, C#1, eb2, G#3, Fb3 are suitable for Low Note.
  773.  
  774. Note that C4 is middle C (ca. 261 Hz) and that the flat sign is
  775. just a 'b' or 'B' (bravo), and the sharp sign is a pound sign.
  776.  
  777. In the integer gadget used for channel number, you may enter the
  778. MIDI channel you want that voice to play to.  This permits
  779. separate voices to play on separate synthesizer sounds.  Only the
  780. number of voices 0 to max_voices-1 (selected in the Forms menu)
  781. will play.   If you wish to hear all the voices when different
  782. channels are assigned, use "OMNI ON" on your synthesizer.  Any
  783. AlgoRhythms voice may be set to any MIDI channel.  Two different
  784. voices may be set to the same MIDI channel.  When AlgoRhythms
  785. starts, all voices are assigned to MIDI channel 0 (of 0 to 15, or
  786. channel 1 of 1 to 16).
  787.  
  788.     If you select the Walking item with the mouse, the voice
  789. will toggle back and forth between playing random notes in the
  790. scale, or playing notes adjacent to the last note played in each
  791. voice.  A mathematical random walk allows a drunk to take any
  792. sized step in any direction.  AlgoRhythms uses a walk that can do
  793. three things: it can go up a step, down a step, or not move.
  794. When the walk comes to a voice's Low Note or High Note, it turns
  795. back in the other direction.  A walking voice completely
  796. disregards the Pitch form curve.
  797.  
  798. Graphic output
  799.  
  800. AlgoRhythms draws a graphic representation of the shape or form
  801. of the piece to be played.  In the drawing there are four
  802. waveforms labeled "Pitch," "Rhythm," "Dynamics," and "Texture."
  803. As the music plays, you will see a time line move across the
  804. Pitch curve.  Note the following:
  805. The higher the pitch curve, the higher the pitch (unless
  806. walking).
  807. The thicker the pitch curve, the wider the range playing (within
  808. the voice's range).
  809. The higher the Rhythm curve, the slower the music plays.
  810. The thicker the Rhythm curve, the less regular the music is.
  811. The higher the Dynamic curve, the louder the music.
  812. The thicker the Dynamic curve, the more variety in dynamics,
  813. i.e., the more accented the music sounds.
  814. The thicker the Texture curve, the more voices play, to
  815. max_voice.
  816.  
  817. Getting Good Music from AlgoRhythms
  818.  
  819. It is possible for AlgoRhythms to produce music which is fairly
  820. pretty, and even somewhat human-like.  The music can sound as
  821. though someone is idly improvising with no pretense to melodic
  822. development.  The music can sound pretty due to the "windchime
  823. effect."  Windchimes with a pretty scale will produce euphony
  824. regardless of how the wind hits the chimes.  The prettiest scales
  825. in AlgoRhythms are the Pentatonic scales and the hira joshi
  826. scale.  In addition, by using the "walking" pitch selection, the
  827. pitches roam up and down the scale, sounding vaguely melodic.
  828. Using the Short_Pentatonic scale with walking pitch selection can
  829. produce surprisingly human results.  Wider spreads of dynamics
  830. also sound more accented and rhythmic.
  831.  
  832. The whole-tone scale is also fairly pretty regardless of what is
  833. played.  This scale was common in French Impressionism,
  834. especially in works of Debussy.
  835.  
  836. Because voice number zero has precedence, it amounts to the solo
  837. voice.  The other voices function usually as accompaniment, at
  838. times overtaking the solo.  Therefore, if you use multiple
  839. synthesizer voices, you may wish to assign voice zero to a
  840. soloist voice, such as a saxophone, trumpet, clarinet, or
  841. electric guitar.  The middle voices (remember that you a limited
  842. by how you set max_voice) could be accompaniment instruments such
  843. as guitar, piano, and even drums.  The last voices (close to
  844. max_voice) could be unusual voices that add surprising colors
  845. once in a while, because they only play when the texture curve is
  846. very thick.
  847.  
  848. The sinusoid form curves used by AlgoRhythms were developed for
  849. controlling musical form by the author in 1976.  The purpose was
  850. to answer the question: how can music be organized if there are
  851. no high-Q, narrow-bandwidth, musical pitches in the music?  The
  852. history of Western classical music has been the history of
  853. organizing sound by pitch.  Counterpoint, harmony and melodic
  854. studies were the center of musical developement for hundreds of
  855. years because the instruments used made clear pitches of narrow
  856. bandwidth.  What if we used instruments of low-Q, higher
  857. bandwidth sounds?  For example, filtered white noise, such as
  858. ocean surf sounds, wind sounds, drum sounds, and so on, can not
  859. be organized using either Bach's counterpoint, tonal harmony, or
  860. Schoenberg's serial technique.  (It took Boulez and Stockhausen
  861. to try to arrange percussion sounds in a serial fashion.) 
  862. Nevertheless, such sounds can be high or low, fast or slow, and
  863. loud or soft.  I came on the idea of slowly changing the
  864. character of the music by curves that created gradual changes
  865. that never stayed in one character of music for very long.  The
  866. mean and range of pitch, pace, and dynamic, were graphed on paper
  867. in 1976 almost exactly as AlgoRhythms graphs them.  My musical
  868. taste at the time called for fluid non-regular rhythm,
  869. non-motivic wanderings, and gradually changing character of
  870. music.  The purpose of AlgoRhythms is to implement this approach
  871. to organizing sound, even though, most of the time, it is used
  872. with high-Q musical sounds from MIDI instruments.
  873.  
  874. Playing the provided form 20fastwalk.form, AlgoRhythms can play
  875. 330 notes per second.  That's 660 note on's, half with a zero
  876. dynamic to turn off notes.  One voice alone in this form (setting
  877. Max Voices to 1), plays about 68 notes per second.
  878.  
  879. STRUCTURE OF ALGORHYTHMS
  880.  
  881. AlgoRhythms was my first large C program (about 4640 lines), and
  882. it suffers from that distinction.  Nevertheless, I will outline
  883. the structure for those who want to understand it.
  884.  
  885. There are several source files for the AlgoRhythms program.  
  886.  
  887. AlgoRhythms.c and AlgoRhythms.h
  888. Scales.c and Scales.h
  889. Window.c and Window.h
  890. Menus.c and Menus.h
  891. Gadgets.c and Gadgets.h
  892. DrawForm.c and DrawForm.h
  893. MIDIserial.c and MIDIserial.h
  894. MusicTimer.c and MusicTimer.h
  895. Record.c and Record.h
  896.  
  897. AlgoRhythms.c contains the code with most of the meat in it.
  898. It manages the work performed by the other modules.  It contains
  899. the routine MakeEvent, which selects the exact pitch, duration,
  900. and dynamic to use when playing the next note event.  It contains
  901. the musical structures, Events (the list of notes currently
  902. playing), and the form structures, Pitch_Form, Duration_Form,
  903. Dynamics_Form, and Texture_Form.   The form structures contain
  904. the selections made on the menus or brought in from the form
  905. file.  They include the four parameters mean period, mean phase,
  906. spread period and spread phase described above.  Texture_Form has
  907. all four members, but only spread period and spread phase are
  908. used to determine how many voices should be playing.
  909.  
  910. Scales.c holds the available musical scales, and permits
  911. transposition of the current scale into any key.  Other scales
  912. can be used in the program by editing them into a form file and
  913. loading the file into the program. 
  914.  
  915. Window.c contains set-up and management code for the window.
  916.  
  917. Menus.c contains the menu structures and menu decoder, but does
  918. not take any action on menu events.  Action on menu events is all
  919. taken in AlgoRhythms.c.
  920.  
  921. Gadgets.c produces the requester and gadget for string input, a
  922. sliding gadget for phase input, and the Voice Parameter
  923. requester.
  924.  
  925. DrawForm.c draws or refreshes the graphical representation of the
  926. music to be played, and draws the time indicator.
  927.  
  928. MIDIserial.c opens the serial device at the MIDI baud rate,
  929. writes MIDI note-on and note-off commands to the serial device,
  930. and closes it at the end of the program.
  931.  
  932. MusicTimer.c opens the timer device and provides AlgoRhythms with
  933. the current time.  Time in AlgoRhythms is measured in a double
  934. (floating-point) number of seconds, with microseconds.  It was
  935. intended to avoid quantized musical time, in preference for fluid
  936. time without a beat.  Probably an integer representation would
  937. have served just as well.  In fact, musical time is quantized by
  938. the "pulse" selection anyway, in twenty-fifths of a second, but
  939. this can be over-ridden by selecting a zero value for "pulse."
  940.  
  941. Record.c maintains data structures for recording, and writes the
  942. standard MIDI file of the recording.  Memory is dynamically
  943. allocated as it is needed to record output.  When memory runs
  944. out, the Record function is turned off.
  945.  
  946. BIBLIOGRAPHY
  947.  
  948. Bolognesi, T. 1983.  "Automatic Composition: Experiments with
  949. Self-Similar Music."  Computer Music Journal 7(1):25-36
  950.  
  951. De Furia, Steve, and Scacciaferro, Joe.  1989.  MIDI Programmer's
  952. Handbook.  M & T Books.  Redwood City, California.
  953.  
  954. Fox, Colin; Dawson, Bruce.  "ReqLib." AmigaLibDisk 400.  Fred
  955. Fish, ed. Tempe, AZ.  1990.
  956.  
  957. Janzen, Thomas E. "AlgoRhythms." AmigaLibDisk356.  Fred Fish, ed.
  958. Tempe, AZ.  1990.
  959.  
  960. Janzen, Thomas E.  "AlgoRhythms: Automatic Composition for a
  961. Personal Computer."  IEEE Tutorial:  Computer Generated Music. 
  962. 1992.  IEEE Press.  Denis Baggi, ed.
  963.  
  964. Janzen, Thomas E.  "Categories of Aesthetic Appeal in Computer
  965. Music." M.I.T. Computer Music Journal 10(3), included in On the
  966. Wires of Our Nerves Heifetz, ed., Buchnell U. Press 1989
  967.  
  968. Messiean, Olivier Technique of My Musical Language.
  969.  
  970. Myhill, John.  1979.  "Controlled Indeterminacy:  A First Step
  971. Toward a Semistochastic Music Language."  M.I.T. Computer Music
  972. Journal 3(3).  Included in Foundations of Computer Music, Roads
  973. and Strawn, ed. M.I.T. Press, Cambridge, 1985.
  974.  
  975. Xenakis, I. 1971.  Formalized Music.  Bloomington: Indiana
  976. University Press.
  977.  
  978. Thanks to Len Fehskens and Jack Deckard for performing initial
  979. test and offering practical suggetions, resulting in many
  980. improvements and features.
  981.  
  982. APPENDIX
  983.  
  984. Note Names and MIDI Numbers
  985.  
  986. MIDI    Pitch    Frequency
  987.  
  988.   12      C 0    16.35
  989.   13      C#0    17.32
  990.   14      D 0    18.35
  991.   15      D#0    19.45
  992.   16      E 0    20.60
  993.   17      F 0    21.83
  994.   18      F#0    23.12
  995.   19      G 0    24.50
  996.   20      G#0    25.96
  997.   21      A 0    27.50
  998.   22      A#0    29.14
  999.   23      B 0    30.87
  1000.   24      C 1    32.70
  1001.   25      C#1    34.65
  1002.   26      D 1    36.71
  1003.   27      D#1    38.89
  1004.   28      E 1    41.20
  1005.   29      F 1    43.65
  1006.   30      F#1    46.25
  1007.   31      G 1    49.00
  1008.   32      G#1    51.91
  1009.   33      A 1    55.00
  1010.   34      A#1    58.27
  1011.   35      B 1    61.74
  1012.   36      C 2    65.41
  1013.   37      C#2    69.30
  1014.   38      D 2    73.42
  1015.   39      D#2    77.78
  1016.   40      E 2    82.41
  1017.   41      F 2    87.31
  1018.   42      F#2    92.50
  1019.   43      G 2    98.00
  1020.   44      G#2    103.83
  1021.   45      A 2    110.00
  1022.   46      A#2    116.54
  1023.   47      B 2    123.47
  1024.   48      C 3    130.81
  1025.   49      C#3    138.59
  1026.   50      D 3    146.83
  1027.   51      D#3    155.56
  1028.   52      E 3    164.81
  1029.   53      F 3    174.61
  1030.   54      F#3    185.00
  1031.   55      G 3    196.00
  1032.   56      G#3    207.65
  1033.   57      A 3    220.00
  1034.   58      A#3    233.08
  1035.   59      B 3    246.94
  1036.   60      C 4    261.63 MIDDLE C
  1037.   61      C#4    277.18
  1038.   62      D 4    293.66
  1039.   63      D#4    311.13
  1040.   64      E 4    329.63
  1041.   65      F 4    349.23
  1042.   66      F#4    369.99
  1043.   67      G 4    392.00
  1044.   68      G#4    415.30
  1045.   69      A 4    440.00
  1046.   70      A#4    466.16
  1047.   71      B 4    493.88
  1048.   72      C 5    523.25
  1049.   73      C#5    554.37
  1050.   74      D 5    587.33
  1051.   75      D#5    622.25
  1052.   76      E 5    659.26
  1053.   77      F 5    698.46
  1054.   78      F#5    739.99
  1055.   79      G 5    783.99
  1056.   80      G#5    830.61
  1057.   81      A 5    880.00
  1058.   82      A#5    932.33
  1059.   83      B 5    987.77
  1060.   84      C 6    1046.50
  1061.   85      C#6    1108.73
  1062.   86      D 6    1174.66
  1063.   87      D#6    1244.51
  1064.   88      E 6    1318.51
  1065.   89      F 6    1396.91
  1066.   90      F#6    1479.98
  1067.   91      G 6    1567.98
  1068.   92      G#6    1661.22
  1069.   93      A 6    1760.00
  1070.   94      A#6    1864.66
  1071.   95      B 6    1975.53
  1072.   96      C 7    2093.00
  1073.   97      C#7    2217.46
  1074.   98      D 7    2349.32
  1075.   99      D#7    2489.02
  1076.  100      E 7    2637.02
  1077.  101      F 7    2793.83
  1078.  102      F#7    2959.96
  1079.  103      G 7    3135.96
  1080.  104      G#7    3322.44
  1081.  105      A 7    3520.00
  1082.  106      A#7    3729.31
  1083.  107      B 7    3951.07
  1084.  108      C 8    4186.01
  1085.  109      C#8    4434.92
  1086.  110      D 8    4698.64
  1087.  111      D#8    4978.03
  1088.  112      E 8    5274.04
  1089.  113      F 8    5587.65
  1090.  114      F#8    5919.91
  1091.  115      G 8    6271.93
  1092.  116      G#8    6644.88
  1093.  117      A 8    7040.00
  1094.  118      A#8    7458.62
  1095.  119      B 8    7902.13
  1096.  120      C 9    8372.02
  1097.  121      C#9    8869.85
  1098.  122      D 9    9397.27
  1099.  123      D#9    9956.06
  1100.  124      E 9    10548.08
  1101.  125      F 9    11175.30
  1102.  126      F#9    11839.82
  1103.  127      G 9    12543.86
  1104.