home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / wtf30.zip / WTF30J.TXT < prev    next >
Text File  |  1995-05-31  |  47KB  |  1,107 lines

  1.                      The Well-Tempered Fractal v3.0
  2.  
  3.     A Composer's Tool for the Derivation of Musical Motifs, Phrases and
  4.  Rhythms From The Beauty and Symmetry of Fractals, Chaotic Attractors and
  5.                        Other Mathematical Functions
  6.  
  7.                            Copyright 1993-1995
  8.                           By Robert Greenhouse
  9.  
  10.  
  11.                                  Abstract
  12.  
  13. The Well-Tempered Fractal is a program which composes musical melodies by
  14. mapping fractal images to musical scales. Ten different fractal types may
  15. be mapped to twenty-one different musical scales. Twenty symmetry operators
  16. may be applied to the image as it is plotted. The output may be heard on an
  17. ordinary PC speaker or written to a MIDI event file which can be converted
  18. to a standard MIDI file for use with MIDI instruments or sound cards. The
  19. aim of the program is to produce fractally generated melodies to be used by
  20. composers as the starting point for entire musical compositions.
  21.  
  22.  
  23.                              Table of Contents
  24.  
  25.  
  26. Abstract                                                        2
  27. Contents                                                        3
  28. Introduction                                                    4
  29. An Important Note on the Philosophy Behind the Program          6
  30. An Overview of the Musical Composition Process                  7
  31. How the Program Works                                           8
  32.      Selecting a Fractal                                        8
  33.      Symmetry                                                   8
  34.      Music                                                      8
  35.      Data Compression                                           8
  36.      Converting the Midi Event File                            10
  37. Documenting the Compositional Process                          11
  38. The Fractals                                                   13
  39.      Mira Fractal                                              13
  40.      KAM Torus Fractal                                         14
  41.      Hopalong Fractal                                          15
  42.      Seahorse or Hippocampus Fractal                           16
  43.      Chebychev Functions                                       17
  44.      Ikeda Attractor                                           18
  45.      Julia Fractal                                             19
  46.      Ivanov Fractal                                            20
  47.      Stewart-Golubitsky Chaotic Icons                          21
  48.      Duffing Attractor                                         22
  49.  
  50. The Scales                                                     23
  51. Active Keys for WTF30 (Command Summary)                        24
  52. Release History                                                26
  53. What's Next ?                                                  27
  54. Registration Deal                                              28
  55. Registration Form                                              29
  56.  
  57.  
  58.                                Introduction
  59.  
  60. The Well-Tempered Fractal was originally conceived after several years of
  61. experiments in generating fractally derived sounds. Music From the Fringe
  62. was a series of programs which explored the potential of fractals to create
  63. music. Although many fascinating sounds could be produced merely by mapping
  64. calculated values to audio frequencies, the result was never musical in the
  65. way that most people think of music. Hoots and howls and screeches were
  66. intriguing and even exciting to a few, but most regarded them as bizarre
  67. and annoying.
  68.  
  69. It was clear that if fractals were ever to be used to produce music which
  70. could pass as musical, it would not come about by simple or even complex
  71. mathematical equations alone. What was missing was some degree of artistic
  72. control over the mathematics. The Well- Tempered Fractal was designed to
  73. provide that control over the mathematics.
  74.  
  75. Several things were clear from the initial experiments with Music From the
  76. Fringe. First of all a mapping scheme which permits a continuum of audio
  77. frequencies over a portion of the human hearing range will produce music
  78. which sounds out of tune. Although the human ear can hear an incredible
  79. number of frequencies, in general we prefer discreet notes in our music. A
  80. range of less than one hundred notes will cover all the traditional music
  81. that has ever been written down. The WTF would therefore be based on
  82. mapping fractals to discreet notes of a scale in a limited range of human
  83. hearing.
  84.  
  85. The second thing which flows from the first is that music as we normally
  86. think of it is of much lower resolution than a fractal image. That is we
  87. will be mapping a very high resolution image to a very low resolution sound
  88. scale of rather limited range. The human ear hears best over an eight
  89. octave range providing fewer than 100 discrete notes (more if microtonal
  90. music is used). However most musical melodies use a much narrower range
  91. than 100 notes. The WTF would therefore need to produce low resolution from
  92. high resolution data.
  93.  
  94. The third point which was clear from the early experiments was that few
  95. listeners would be willing to listen to music derived from the tens or
  96. hundreds of thousands of points needed to construct a fractal image. The
  97. amount of data present in a fractal is far more than in a typical musical
  98. composition if we restrict data to pitch and duration. Again this implies
  99. that in order to create music from a fractal image, the WTF will have to
  100. discard a majority of the data.
  101.  
  102. A fourth point which was obvious before any experiments but which became
  103. painfully obvious from Music From the Fringe, is that listeners like some
  104. degree of order which is at least comprehensible. Music which is devoid of
  105. recognizable pattern quickly becomes uninteresting to most listeners simply
  106. because they fail to understand it. Composing music is very much like
  107. writing literature. If you scatter letters haphazardly over a page no one
  108. is much interested, even if there is some scheme of arrangement to the
  109. letters. Unrelated words make some recognition possible, but still there is
  110. not much interest. Literature requires themes, phrases, ideas all tied
  111. together in a coherent unit before it is interesting. Likewise if the
  112. listener cannot recognize any order in the music, that music is doomed to
  113. be at best a curiosity rather than good music. The WTF would therefore have
  114. to create coherent patterns for listeners to understand.
  115.  
  116. A fifth point related to the previous is that music which wildly jumps
  117. around is not very interesting for long nor is music which is too
  118. predictably correlated. Even if there are recognizable patterns in the
  119. music, most great music does not constantly jump all over the entire range
  120. of permitted frequencies.  It follows some simple grammatical rules which
  121. rely on relatively small intervals mixed with step-wise motion within
  122. musical phrases. On the other hand, if music wanders aimlessly in a
  123.  
  124. stepwise fashion or is too predictable, the listener soon is bored. What is
  125. needed for interesting music is a careful mix between the orderly and
  126. predictable and the surprising and unpredictable. The WTF would therefore
  127. have to overcome this tendency of fractals toward wild fluctuation over a
  128. wide range and at the same time avoid continuous functions which step by
  129. step would lead the listener into complete boredom.
  130.  
  131. In summary the WTF would have to do the following:
  132.  
  133.       Produce discrete musical notes rather than precise frequencies.
  134.  
  135.       Create music over a limited musical range of a few octaves.
  136.  
  137.       Create music using only a fraction of the total number of data
  138.         points in a fractal.
  139.  
  140.       Produce recognizable patterns in the music.
  141.  
  142.       Produce music which neither jumps around excessively nor is too
  143.         predictable and orderly.
  144.  
  145. At first glance these appear to be rather severe limitations to be imposed
  146. on a branch of mathematics whose beauty is derived from its complexity. The
  147. production of relatively simple music from very complex mathematics is
  148. bound to leave mathematicians and composers alike somewhat dissatisfied.
  149.  
  150.  
  151.  
  152.           An Important Note on the Philosophy Behind the Program
  153.  
  154.  
  155. WTF is not intended to be an automated composing system which allows one
  156. mindlessly to press a key and produce a piece of music. To be sure, WTF
  157. could be used in this way. It can also be used as a pleasant screen saver
  158. or just as an amusing toy.
  159.  
  160. My real intention in writing WTF is to use fractals to produce raw data
  161. for musical compositions which skilled composers may then manipulate, add
  162. to, change, cut and paste, add improvisation to or do just about anything
  163. that the imagination will lead them to do.
  164.  
  165. The point is that the ideas which lead to the musical compositions are
  166. generated from fractals and as such they may have a quality to them that
  167. would be hard for a traditional composer to generate. The constant
  168. bombardment of musical phrases and ideas which are considered acceptable or
  169. pleasing music is hard to escape if one lives in our society today.
  170. Consequently it is difficult for most composers to come up with truly
  171. original music. Avant Guard music tends to be so bizarre that the average
  172. listener is alienated.
  173.  
  174. Foremost in my mind remains the principle that in the end the composer
  175. must retain artistic control over what he or she puts down on paper.
  176. Without this principle it is hard for me to accept what the program
  177. produces as art. With WTF it is possible to produce a new full length
  178. composition in score notation in about 10 minutes, assuming that the
  179. appropriate sequencing and notation software is available. Possible, that
  180. is, if the user does nothing but convert WTF output into musical scores.
  181. That means a total of about 48 new compositions in an average 8 hour day!
  182. It would not take long to overtake Telemann as the most prolific composer
  183. in history going at that rate. But the quality of the output would be as
  184. good as one could expect with only ten minutes work involved.
  185.  
  186. I have spent as much as perhaps 10 - 12 hours manipulating the data of a
  187. single fractal into a final composition before I was satisfied with the
  188. result. In the end the music was a composition which I could probably never
  189. have imagined without the aid of a computer, but which the computer could
  190. never have produced in such an elaborated form.
  191.  
  192.  
  193.  
  194.               An Overview of the Musical Composition Process
  195.  
  196. The program is started by typing "WTF30" followed by <CR> (the enter key).
  197. The title screen appears and any other keystroke starts the program. The
  198. mapping scheme is quickly calculated for all the different musical scales
  199. and the first fractal begins.
  200.  
  201. The user can choose a fractal type with the function keys F1 - F10, but the
  202. coefficients for each function are randomized so that no two fractals are
  203. exactly alike. When an interesting pattern comes up, the user may start the
  204. fractal over again from the beginning by hitting <CR> or generate a new
  205. fractal of the same type with the <Space> bar. Music may be turned on by
  206. pressing <M> at any time (PC speaker) to give an idea of what the fractal
  207. sounds like. It may be toggled off to speed up the fractal display. In
  208. addition the X or Y component of the music may be toggled on or off by
  209. pressing <X> or <Y>. Look in the status box to see which is playing.
  210.  
  211. Once a potentially interesting musical fractal is found, scale mappings may
  212. be tried by using the left and right arrow keys. The name of the scale
  213. appears in the lower hand corner (status area) of the screen. Other
  214. parameters may be adjusted such as the offset and length of note, but more
  215. will be said about that in the control summary section below.
  216.  
  217. When the user is ready to capture the music as output, pressing <W> (for
  218. <W>rite) will begin writing a MIDI event file. A maximum limit of 100,032
  219. bytes has been set since the user's hard disk might rapidly fill up without
  220. that limitation. The recording process may be started at any point in the
  221. fractal or right from the beginning by pressing <B> (for <B>eginning)
  222. followed by <W>. Typing <W> again stops the recording process.
  223.  
  224. When the file is finished (the status box shows the work "Midi" while the
  225. file is being written), the user may exit or continue to look for more
  226. fractals. The output file called "TXT2MIDI.???" (where ??? represents a
  227. sequential numbering) contains information on all the Midi events - pitch
  228. and time only - which have occurred. In addition the header contains
  229. information about the kind of fractal and the parameters used by the
  230. program to generate the music. This file is then processed by a utility
  231. called "T2MF.EXE" (text-to-midi-file). T2MF.EXE and its companion program
  232. MF2T.EXE are part of a wonderful set of Midi utilities written by Piet van
  233. Oostrum of the Netherlands. They allow the interconversion of Midi event
  234. files and standard .MID files, thus making the job of Midi file creation an
  235. exceedingly simple process. The program archive is called MF2T.ZIP and is
  236. available from Piet's ftp site at ftp.cs.ruu.nl, an incredible repository
  237. of Midi information and files.
  238.  
  239. After the .MID file is created, it is loaded into the user's preferred
  240. sequencing software and now the real work begins. An appropriate voice is
  241. assigned (often one voice will sound much better than another) and then the
  242. composer manipulates the data in any way which seems appropriate. (This is
  243. where the real art begins as well.) When the composer is satisfied with the
  244. result, it may be printed out in score notation or played by whatever Midi
  245. setup is available.
  246.  
  247. That in brief is how a piece is composed with WTF.
  248.  
  249.  
  250.  
  251.                            How the Program Works
  252.  
  253.                            Selecting a Fractal
  254.  
  255. After typing "WTF30" the title screen appears. Following any key press,
  256. the notes for the scale mappings are quickly calculated and loaded into
  257. memory. The default fractal (Mira) begins to appear after the coefficients
  258. of the function are randomized. At this point I would suggest that the user
  259. experiment with the F-keys and check out the different fractal types which
  260. are available. F1 gives the Mira fractal, F2 the KAM Torus, F3 the
  261. Hopalong, F4 the Seahorse or Hippocampus fractal, F5 Chebyshchev fractal,
  262. F6 the Ikeda Attractor, F7 the Julia fractal, F8 the Ivanov fractal (Thank
  263. you, Oleg!), F9 the Stewart - Golubitsky icon fractals, and F10 the Duffing
  264. Attractor.
  265.  
  266. Each time the <Space> bar is pressed, a new fractal of the same type
  267. begins by randomizing the coefficients of the functions. When an unstable
  268. condition results, the fractal terminates itself. A given fractal may be
  269. started from the beginning by pressing <CR>, in which case it starts
  270. immediately, or by pressing <B> in which case it pauses and waits for any
  271. keypress before starting over. At any point the fractal plot may be paused
  272. by pressing <P>.
  273.  
  274.  
  275.                                 Symmetry
  276.  
  277.  
  278. Symmetry is imposed on any fractal plot by using the number keys or <Shft>
  279. number combination. Symmetry operators multiply the number of points being
  280. plotted by plotting symmetrically placed points which correspond to the
  281. calculated one. This is a very important feature in the composition process
  282. since symmetry in the plot results in a kind of symmetry in the music. It
  283. also takes a continuous plot and breaks it up into several symmetrically
  284. disposed plots thus turning boring music into relatively interesting
  285. melodies. Such plots as the Duffing Attractor may greatly benefit by the
  286. use of symmetry in creating music. A summary of the types of symmetry
  287. available appears in the command summary.
  288.  
  289.  
  290.                                   Music
  291.  
  292.  
  293. Music may be turned on at any point by hitting the <M>usic key. Often it
  294. is more efficient to leave the music off until an interesting fractal is
  295. found since the calculation and display is greatly slowed down by playing
  296. music. The X or Y component of the music may be selectively toggled on or
  297. off by hitting <X> or <Y> once the music is playing. The length of the
  298. notes may be changed by hitting <L>egato, <N>ormal, or <S>taccato. The
  299. velocity of execution of the music may be changed by using the <home> and
  300. <end> keys (the tempo varies between 40 - 250 bpm and the notes played are
  301. sixteenth notes). The musical offset (i.e. the key of the music) may be
  302. changed with the <up> and <down> arrows or shifted to a different octave
  303. with the <PgUp> or <PgDn> keys.
  304.  
  305. At present the rhythmic variations available are very limited at this
  306. time. Duple rhythm is the default and that may be changed to triple rhythm
  307. by using the <R>hythm toggle key. An <I>mprovise mode interjects trills and
  308. ornaments at random throughout the music.
  309.  
  310.  
  311.                             Data Compression
  312.  
  313. As pointed out in the introduction few people would sit through a musical
  314. piece of a million or even ten thousand notes. People tend to have lives to
  315. lead and consequently have a somewhat limited attention span. This is one
  316.  
  317. of the basic challenges in extracting relatively low resolution music out
  318. of relatively high resolution fractals. My answer to this challenge is
  319. through data compression or perhaps more appropriately expressed,
  320. "selective data extraction".
  321.  
  322. Simply stated, this means that we can sample every 51st note or every
  323. 798th note instead of every note in the entire fractal plot. If we do not
  324. use this selective sampling technique, we must necessarily be content with
  325. mapping only a tiny fraction of the entire fractal to music. This is a very
  326. important parameter of the compositional process which the composer needs
  327. to learn to exploit. It is one of the mathematically creative aspects of
  328. composition which remains under the artist's control. With it one can take
  329. a single fractal and extract thousands of different compositions depending
  330. upon how often data is extracted from the plot.
  331.  
  332. The default CF or compression factor is 1. This means that every point of
  333. the fractal is mapped to music. As stated above the plotting process is
  334. greatly slowed down if the music is turned on and the default compression
  335. factor is used. If the CF is set to 51, then 51 points will be plotted for
  336. every point which is played. Obviously unless one has super-computing
  337. resources, there will come a point where the CPU cannot calculate fast
  338. enough to play smooth continuous music. On a 33 Mhz 486 machine this
  339. happens at a CF in the hundreds. A machine without a math coprocessor will
  340. be severely limited in this aspect. However it does not matter from the
  341. point of view of the MIDI file produced. I usually turn off the music when
  342. I record a MIDI event file. The data compression factor determines which
  343. notes to write to file.
  344.  
  345. Data compression is applied to the plotting fractal by using <Ctrl>
  346. <UpArrow> or <Ctrl> <DownArrow> to increment CF by 1. Increments of 10 or
  347. 100 are available using <Ctrl> in conjunction with <PgUp> / <PgDn> and with
  348. <Home> / <End> respectively. The status area on screen shows the current CF
  349. value.
  350.  
  351. In conjunction with the CF function of the program, there is a trace mode
  352. which circles in white each point as it is played or written to file. The
  353. trace mode is toggled by the <Ctrl><5> combination only while the music or
  354. Midi record is on. This trace mode becomes vital in understanding the
  355. patterns of notes which are being played or written to file.
  356.  
  357. For example, if one is using a CF = 7 on a fractal to which C-7 symmetry
  358. has been applied (by pressing the <7> number key), it becomes obvious in
  359. the trace mode that the symmetry function serves little purpose since the
  360. music being played comes from every seventh point and thus is equivalent to
  361. a CF = 1 and no symmetry operator applies (i.e. C-1, the identity). On the
  362. other hand, if the CF is now changed to 6 or to 8, the music now comes from
  363. regularly rotating segments of the seven fractal components of the
  364. symmetry. Change the CF to 9, 10, 11, 12, or 13 and a completely different
  365. musical piece results! At CF = 14, then a plot with C-7 symmetry yields the
  366. same result as no symmetry operator and a CF = 2.
  367.  
  368. By carefully studying the behavior of the selected notes using the trace
  369. mode, one may experiment and choose the desired result. The trace mode
  370. circles may be erased by hitting <CR> and starting the fractal over again.
  371. One often observes that in some of the plots that radiate out from the
  372. origin in a polar fashion (e.g. Mira, KAM Torus, Ivanov, etc.) a given CF
  373. will select a clockwise sequence of plotted points while incrementing the
  374. CF by one gives a counterclockwise sequence of points. In such a function
  375. as the Duffing Attractor which is painfully boring in the C-1 symmetry mode
  376. due to the continuous nature of the function, the use of CF allows one to
  377. sample the function at any point interval along the function and thus make
  378. an interesting piece of music in doing so.
  379.  
  380.  
  381.                       Converting the Midi Event File
  382.  
  383. Once the Midi event file is written it must be converted into a standard
  384. Midi file in order to play it on a sound card, module or synthesizer.  Piet
  385. van Oostrum of the Netherlands has written a wonderful utility which makes
  386. the creation of Midi files a trivial matter of writing a simple event file
  387. with the channel, pitch and duration information of the notes and a simple
  388. header. The output file is processed by T2MF.EXE (text-to-midi-file) and a
  389. standard Midi file results. A companion utility to reverse the process is
  390. also included in his archive, called MF2T.ZIP. The package is available by
  391. ftp from ftp.cs.ruu.nl.
  392.  
  393. The output file created by WTF30 is converted with T2MF.EXE and the
  394. resulting standard Midi file can be loaded into any standard sequencing
  395. software or score notation software which will read Midi files.
  396.  
  397. Now the real work begins. The raw data is assigned any suitable voice, is
  398. cloned to other tracks, cut, pasted, transposed, notes extracted onto other
  399. tracks, notes lengthened, shortened, accented, or whatever the composer's
  400. imagination dictates. Rhythm patterns may be discovered which are regular
  401. and percussion parts may be composed to accentuate these rhythms. The
  402. default 4/4 meter may (and probably should) be thrown out and new bar lines
  403. drawn according to the patterns found.
  404.  
  405. Not every file which is written will necessarily be fruitful material for
  406. composition. In fact the user can generate far more data than could ever be
  407. used in an entire lifetime of composition. Most of it will eventually be
  408. discarded. But it is fun to see what comes out and what can be created from
  409. it.
  410.  
  411.  
  412.  
  413.                    Documenting the Compositional Process
  414.  
  415. Now for a bit of controversy:
  416.  
  417. In my discussions with "serious composers", I have often run into virulent
  418. anti-science sentiments when it comes to creating music.  Comments such as
  419. "I don't need to see any formulas to know if it's good music" or "Science
  420. has got no place in the artistic process" have been hurled at me in flaming
  421. messages by people who either do not understand the scientific method or
  422. who cannot accept the use of science and art together.  Epithets which I
  423. will not repeat here have been used against me for my attempts to create
  424. "bogus art".  It is clear that such people do not understand what is going
  425. on here.
  426.  
  427. I strongly believe that if I am to claim that the music which I produce
  428. using the Well- Tempered Fractal is indeed fractal music, I must
  429. demonstrate that this is so for others to see. This is not traditional
  430. music. The music results from an intimate mixture of art and science. Art
  431. and science have different rules of play which are often in conflict. Art
  432. tends to be emotional, intuitive, and expressive whereas science tends to
  433. be rational, provable and descriptive.
  434.  
  435. It is not sufficient to show a pretty design, play some pretty music and
  436. then say the music came from the design. If I invoke a mathematical
  437. calculation as the source of that pretty music, my calculations must be
  438. open to scrutiny by other experimentors or else it is not good science. On
  439. the other hand, if the result does not please the ear in some way, then it
  440. is not good music.
  441.  
  442. What we have here is a new mode of expression which is neither pure art
  443. nor pure science. It is sure to offend purists on both sides for that
  444. reason. To be complete, the finished product should consist of a formula,
  445. an image and sound. Missing any one of these components and one is left
  446. with an incomplete work. Music which is called fractal without offering
  447. mathematical data is simply music. Likewise, a fractal which is claimed to
  448. be musical with no aural data is simply a fractal.
  449.  
  450. As a means of documenting my work, I do the following:
  451.  
  452.         [Begin the science]
  453.  
  454.         1. A resident screen capture program is loaded before starting WTF.
  455.  
  456.         [Enter a bit of artistic intervention]
  457.  
  458.         2. An interesting fractal is captured as a bit-mapped image by the
  459.         screen capture program.
  460.  
  461.         [Continue pure science]
  462.  
  463.         3. A Midi event file is written for that fractal.
  464.  
  465.         4. The coefficients and name of the fractal type, the compression
  466.         factor, scale type, and offset are read out of the header of the
  467.         Midi event file and noted as the parameters required for the
  468.         generation of the raw notes.
  469.  
  470.         5. The standard Midi file is created from the event file.
  471.  
  472.         [End science]
  473.  
  474.         [Begin art, albeit computer-aided art]
  475.  
  476.         6. The Midi file is manipulated in a sequencer and used as the
  477.         starting point for a musical composition.
  478.  
  479.  
  480.         [Pure art]
  481.  
  482.         7. The composer says that it is good!
  483.  
  484.         [Final housekeeping]
  485.  
  486.         8. The final composition is saved under a different name, thus
  487.         preserving the original unmodified Midi file as evidence of what
  488.         actually came out of the fractal. The new Midi file is evidence of
  489.         what the composer did with that raw data.
  490.  
  491.         [End of the process]
  492.  
  493. In the end, of course, only the final composition is played. But as
  494. evidence of the creative process I have the image, the parameters used to
  495. create the image and the music, the original raw musical data which
  496. resulted from the calculations, as well as the final composition. The
  497. entire body of evidence is in fact a scientific experiment which yields a
  498. beautiful product. It becomes a beautiful product when and if the composer
  499. decides it is so. The composer may work with the data for a while and
  500. discard it if it yields no musically interesting results. Artistic control
  501. is thus firmly maintained. The raw data is computer generated, but the
  502. final product has the stamp of approval of the composer and thus it can be
  503. called art. The composer is left to defend his artistic judgement in the
  504. matter.
  505.  
  506. The process in some ways is similar to the complex chemical synthesis of a
  507. drug in the laboratory. To appreciate the beauty and art which goes into
  508. the making of the drug, one needs to do more than cure his ill with the
  509. drug. To be sure one may take a drug to cure his ills and never question
  510. where the drug came from.
  511.  
  512. To fully appreciate the achievement of the synthesis of a drug one must
  513. study the body of evidence to see how the idea was conceived, executed,
  514. tested and brought to its final place in the market as a medicinal agent.
  515. Such things as the concepts behind the drug's mechanism of action or the
  516. laboratory synthesis of the drug add to a fuller understanding of the
  517. achievement of the action of the drug upon the sick person.
  518.  
  519. Likewise one can listen to "fractal" music and not care where it came
  520. from. But seeing the design, knowing the math by which it was calculated
  521. and seeing and hearing the raw data which led to the final composition adds
  522. to the beauty of the process and provides a greater appreciation of the
  523. achievement.
  524.  
  525. [End of controversy]
  526.  
  527.  
  528.                                The Fractals
  529.  
  530.  
  531. Many of the fractals used in the WTF are well known and documented in
  532. other books and thus little or no theory is discussed here. They are
  533. presented here below in algorithmic form so that the user may see my
  534. implementation of the particular fractal. In some cases I have placed
  535. limitations so that the fractal will stay within certain limits and in
  536. other cases I allow runaway fractals to begin again at a randomly selected
  537. starting point on screen.
  538.  
  539.                             The Mira Fractal
  540.  
  541. The Mira Fractal: This beautiful and varied pattern is described in Hans
  542. Lauwerier's small but fascinating book Fractals: Endlessly Repeated
  543. Geometrical Figures (Princeton Science Library: 1991).
  544.  
  545. The Mira fractal is produced by the following pseudo-code:
  546.     Pick a0, x0, y0
  547.     Pick B close to 1.0
  548.     a = a0
  549.     c = 2 - 2 * a
  550.     x = x0
  551.     y = y0
  552.     w = a * x + c * x * x / (1 + x * x)
  553.     do:
  554.         skip first 100 iterations
  555.         Plot x, y
  556.         z = x
  557.         x = B * y + w
  558.         u = x * x
  559.         w = a * x + c * u / (1 + u)
  560.         y = w - z
  561.     loop
  562.  
  563.  
  564.                            The KAM Torus Fractal
  565.  
  566. The KAM Torus fractal is a weird and wonderful figure which is described
  567. in the documentation to FRACTINT. It is produced by the following
  568. pseudo-code:
  569.  
  570.      Pick a [1 - 100]
  571.      Pick F close to 1.0
  572.      Pick OrbitIteration [e.g. 150]
  573.      Pick OrbitIncrement [e.g. 0.005]
  574.      Pick Orbit [e.g. -1.2]
  575.      Pick MaxOrbit [e.g. 8]
  576.      orbit = - 1.2
  577.      do
  578.           orbit = orbit + OrbitIncrement
  579.           x = orbit / 3
  580.           y = orbit / 3
  581.  
  582.           do
  583.                xnew = x * COS(a) + (x * x - y) * SIN(a)
  584.                ynew = x * SIN(a) - (x * x - F * y) * COS(a)
  585.                x = xnew
  586.                y = ynew
  587.                Skip first 100 iterations
  588.                Plot x, y
  589.           loop OrbitIteration Times
  590.      loop until orbit = MaxOrbit
  591.  
  592.  
  593.                              Hopalong Fractal
  594.  
  595. The Hopalong fractal by Barry Martin is also described in the
  596. documentation to FRACTINT and is produced by the following pseudo-code:
  597.  
  598.      Pick a [e.g. -3 to 3]
  599.      B = SIN(a)
  600.      c = COS(a)
  601.      x0 = 0
  602.      y0 = 0
  603.      x = x0
  604.      y = y0
  605.      do
  606.           skip first 100 iterations
  607.           Plot x, y
  608.           IF x >= 0 THEN sign = 1
  609.                ELSE sign = -1
  610.           xx = y - sign * (ABS(B * x - c) ^ .5)
  611.           yy = a - x
  612.           x = xx
  613.           y = yy
  614.      loop
  615.  
  616.  
  617.                            The Seahorse Fractal
  618.  
  619. The Seahorse or Hippocampus fractal is my own creation (I probably derived
  620. it by playing with someone else's formula) and is very unstable but
  621. beautiful when it stays on screen. It is produced by the following
  622. pseudo-code:
  623.  
  624.      FNg (x) = SIN(x + SIN(3 * x))
  625.      Pick aa [e.g. 0.9]
  626.      Pick bb [e.g. 0.8]
  627.      Pick cc [e.g. 0.7]
  628.      Pick dd [e.g. 0.6]
  629.      Pick ee [e.g. 0.05]
  630.      Pick Lambda0 [e.g. 0.2 - 1.2]
  631.      ee = RND * .2
  632.      FOR ii = -1 TO 1 STEP .5
  633.         FOR jj = -1 TO 1 STEP .1
  634.              xx = ii
  635.              xxadj = xx - 2
  636.              yy = jj
  637.              yyadj = yy - 2
  638.              lambda = Lambda0
  639.              FOR i = 1 TO 30 STEP .5
  640.                 yyadj = yy - 2
  641.                 xxadj = xx - 2
  642.                 Plot xxadj, yyadj
  643.                 xold = xx
  644.                 yold = yy
  645.                 xx = ee * i + (aa * xold - lambda * FNg(cc * yold))
  646.                 yy = ee * i + (bb * yold - lambda * FNg(dd * xold))
  647.              NEXT
  648.         NEXT
  649.      NEXT
  650.  
  651.  
  652.                             Chebychev Functions
  653.  
  654. The Chebychev Function is described by Pickover in his book Computers,
  655. Pattern, Chaos and Beauty (p. 285). The Chebychev functions are defined as
  656. follows:
  657.  
  658. Cheby1 (x) = x
  659. Cheby2 (x) = 2 * x * x - 1
  660. Cheby3 (x) = 4 * x * x * x - 3 * x
  661. Cheby4 (x) = 2 * x * Cheby3(x) - Cheby2(x)
  662. Cheby5 (x) = 2 * x * Cheby4(x) - Cheby3(x)
  663. Cheby6 (x) = 2 * x * Cheby5(x) - Cheby4(x)
  664. Cheby7 (x) = 2 * x * Cheby6(x) - Cheby5(x)
  665. Cheby8 (x) = 2 * x * Cheby7(x) - Cheby6(x)
  666. Cheby9 (x) = 2 * x * Cheby8(x) - Cheby7(x)
  667. Cheby10 (x) = 2 * x * Cheby9(x) - Cheby8(x)
  668. Cheby11 (x) = 2 * x * Cheby10(x) - Cheby9(x)
  669.  
  670. The function is plotted as follows:
  671.  
  672.      choose a function ChebyN
  673.      choose x0, y0
  674.      choose h
  675.      x = x0
  676.      y = y0
  677.      for i = 1 to max
  678.           xold = x
  679.           yold = y
  680.           x = xold - h * ChebyN(yold)
  681.           y = yold + h * ChebyN(xold)
  682.           plot (x,y)
  683.      next
  684.  
  685.  
  686.                             The Ikeda Attractor
  687.  
  688. The Ikeda Attractor is also described by Pickover in Computers and the
  689. Imagination (p. 115). It is plotted as follows:
  690.  
  691.      choose c1
  692.      choose c2
  693.      choose c3
  694.      choose rho = 1
  695.      choose x0, y0
  696.      x = x0
  697.      y = y0
  698.      for i = 1 TO max
  699.           plot (x,y)
  700.           temp = c1 - c3 / (1 + x * x + y * y)
  701.                sintemp = SIN(temp)
  702.           costemp = COS(temp)
  703.           xt = rho + c2 * (x * costemp - y * sintemp)
  704.           y = c2 * (x * sintemp + y * costemp)
  705.           x = xt
  706.      NEXT
  707.  
  708.  
  709.                              The Julia Fractal
  710.  
  711.  
  712. The Julia Fractal is described in many sources. This particular
  713. implementation is derived from Hans Lauwerier's Fractals: Endlessly
  714. Repeated Geometrical Figures:
  715.  
  716.  
  717.         choose xc, yc
  718.         xn = .25
  719.         yn = 0
  720.         FOR N = 0 TO 30000
  721.                 skip first 100 iterations
  722.                 a = xn - xc
  723.                 B = yn - yc
  724.                 SELECT CASE a
  725.                         CASE IS > 0
  726.                             xn = SQR((SQR(a * a + B * B) + a) / 2)
  727.                             yn = B / (2 * xn)
  728.                         CASE IS < 0
  729.                             yn = SQR((SQR(a * a + B * B) - a) / 2)
  730.                             IF B < 0 THEN yn = -yn
  731.                             xn = B / (2 * yn)
  732.                         CASE ELSE
  733.                             xn = SQR(ABS(B) / 2)
  734.                             IF xn > 0 THEN yn = B / (2 * xn) ELSE yn = 0
  735.                 END SELECT
  736.  
  737.                 IF N = 0 THEN xn = xn + .5
  738.                 choice = RND
  739.                 SELECT CASE choice
  740.                         CASE IS > .5
  741.                             xn = -xn
  742.                             yn = -yn
  743.                         CASE ELSE
  744.                 END SELECT
  745.         NEXT
  746.  
  747.  
  748.  
  749.                             The Ivanov Fractal
  750.  
  751.  
  752. The Ivanov Fractal was sent to me from Moscow by Oleg Ivanov who has
  753. kindly let me incorporate the code into the WTF. Thank you Oleg! The
  754. algorithm is as follows:
  755.  
  756.     us0 = RND * 8 + 4       ' us,vs are initial coordinates of phase plate
  757.     vs0 = RND * 4 + 2
  758.     rkh = RND
  759.     rq = RND * 9 + 4.5
  760.     us = us0
  761.     vs = vs0
  762.     al = (pi / 2) * 4 / rq
  763.     sa = SIN(al)
  764.     ca = COS(al)
  765.     suu = .5 * svv * 1.6
  766.     vn = 0
  767.     FOR N = 1 TO 30000
  768.         kkk = ((N / 3000) MOD 14) + 1
  769.         skip first 100 iterations
  770.         PlotPoint us, vs
  771.         am = us + rkh * ABS(SIN(vn))
  772.         un = am * ca + vs * sa
  773.         vn = -am * sa + vs * ca
  774.         us = un
  775.         vs = vn
  776.     NEXT
  777.  
  778.  
  779.  
  780.                     The Stewart-Golubitsky Chaotic Icon
  781.  
  782.  
  783. The Stewart-Golubitsky Chaotic Icon is described in the authors' book
  784. Fearful Symmetry: Is God a Geometer? The algorithm is as follows:
  785.  
  786.     x0 = .01
  787.     y0 = .003
  788.     N = INT(RND * 10)
  789.     gamma = .9 + .5 * RND
  790.     omega = RND - .5
  791.     x = x0
  792.     y = y0
  793.     iterates = 1
  794.     lambda = -1.8
  795.     alpha = 2
  796.     beta = 0
  797.     FOR nn = 1 TO 30000
  798.         skip first 100 iterations
  799.         PlotPoint x, y
  800.         zzbar = x * x + y * y
  801.         zreal = x
  802.         zimag = y
  803.         FOR i = 1 TO N - 2
  804.                 za = zreal * x - zimag * y
  805.                 zb = zimag * x + zreal * y
  806.                 zreal = za
  807.                 zimag = zb
  808.         NEXT
  809.         zn = x * zreal - y * zimag
  810.         P = lambda + alpha * zzbar + beta * zn
  811.         xnew = P * x + gamma * zreal - omega * y
  812.         ynew = P * y - gamma * zimag + omega * x
  813.         x = xnew
  814.         y = ynew
  815.     NEXT
  816.  
  817.  
  818.  
  819.                            The Duffing Attractor
  820.  
  821.  
  822. The Duffing Attractor is described by Edward Rietman in Exploring the
  823. Geometry of Nature (Windcrest Publishers: 1989). The algorithm is as
  824. follows:
  825.  
  826.  
  827.         a = RND
  828.         B = RND
  829.         x0 = RND * 7 - 3.5
  830.         y0 = RND * 7 - 3.5
  831.         z0 = RND * 7 - 3.5
  832.         c = RND * 2 - 1
  833.         CONST F = 10
  834.         x = x0
  835.         y = y0
  836.         z = z0
  837.         FOR N = 0 TO 20000
  838.                 skip first 100 iterations
  839.                 PlotPoint x, y
  840.                 FOR t = 1 TO 5
  841.                         d1 = y
  842.                         d2 = -(a * x * x * x + x + B * y) + F * COS(z)
  843.                         d3 = c
  844.                         x = x + d1 * .25 / 25
  845.                         y = y + d2 * .25 / 25
  846.                         z = z + d3 * .25 / 25
  847.                 NEXT
  848.         NEXT
  849.  
  850.  
  851.  
  852.                                 The Scales
  853.  
  854.  
  855. The following scales (or in some cases, arpeggios) are used as the basis
  856. for note mapping and may be changed on the fly by using the <LftArrow> and
  857. <RtArrow> keys. The name of the scale which is currently in use appears in
  858. the status box. (In order to be read properly this table needs to be
  859. printer out with a non-proportional font such as courier.)
  860.  
  861.            0 1 2 3 4 5 6 7 8 910111213141516171819202122232425262728293031
  862.            C D D E E F G G A A B B C D D E E F G G A A B B C D D E E F G G
  863.              b   b     b   b   b     b   b     b   b   b     b   b     b
  864.  
  865. Major:     x   x   x x   x   x   x x
  866. Aeolean:   x   x x   x   x x   x   x
  867. Dorian:    x   x x   x   x   x x   x
  868. Japanese:  x x       x   x  x  x   x
  869. Harmonic 1:x             x         x       x     x     x   x   x
  870. Minor 11:  x             x               x   x   x     x   x   x
  871. Thirteenth:x       x     x   x x       x   x     x
  872. Mideastern:x x     x x   x x   xx
  873. Indian:    x   x   x   x x   x   x x
  874. Arabian:   x x     x x   x x     x x
  875. Whole tone:x   x   x   x   x   x   x   x
  876. Diminished:x   x x   x x   x x     x
  877. Chinese:   x   x   x     x   x     x   x   x
  878. Fourths:   x   x     x   x     x   x   x     x
  879. Harmonic 2:x       x     x     x   x   x   x   x
  880. Phrygian:  x x   x   x   x x   x   x
  881. Blues:     x     x   x x x     x   x   x
  882. Mixolydian:x   x   x x   x   x x   x
  883. Lydian:    x   x   x   x x   x   x x
  884. Locrian:   x x   x   x x   x   x   x
  885. 13#11:     x   x   x   x x   x x   x
  886.  
  887.  
  888.                            Active Keys for WTF30
  889.  
  890. Fractal Types:
  891.  
  892.     F1:             Mira
  893.     F2:             KAM Torus
  894.     F3:             Hopalong
  895.     F4:             Seahorse
  896.     F5:             Chebychev
  897.     F6:             Ikeda
  898.     F7:             Julia
  899.     F8:             Ivanov
  900.     F9:             Icon
  901.     F10:            Duffing
  902.  
  903. Symmetry Operators:
  904.  
  905.     1               Identity
  906.     2               C2
  907.     3               C3
  908.     4               C4
  909.     5               C5
  910.     6               C6
  911.     7               C7
  912.     8               C8
  913.     9               C9
  914.     0               C10
  915.     ! (<Shift> 1)   x -> -x, y -> -y
  916.     @ (<Shift> 2)   x -> -x, y -> y (mirror about the y axis)
  917.     # (<Shift> 3)   x -> x, y -> -y (mirror about the x axis)
  918.     $ (<Shift> 4)   x -> x/k, y -> y/k
  919.     % (<Shift> 5)   x -> maxx - abs(x), y -> maxy - abs(y)
  920.                     x -> -maxx + abs(x), y -> -maxy + abs(y)
  921.                     x -> maxx - abs(y),  y -> maxy - abs(x)
  922.                     x -> -maxx + abs(y), y -> -maxy + abs(x)
  923. ^ (<Shift> 6)       x -> -x, y -> -y
  924.                     x -> y, y -> x
  925.                     x -> -y, y -> -x
  926. & (<Shift> 7)       x -> x + rand*k, y -> y + rand*k
  927. * (<Shift> 8)       x -> x*k, y -> y*k
  928. ( (<Shift> 9)       x -> x/k1, y -> y/k1
  929.                     x -> x*k2, y -> y*k2
  930. ) (<Shift> 0)       x -> x/k1, y -> y/k1
  931.                     x -> x/k2, y -> y/k2
  932.                     x -> x/k3, y -> y/k3
  933.                     x -> x/k4, y -> y/k4
  934.  
  935. Other Keys:
  936.  
  937. <SPACE>             Begin a new fractal of the same type
  938. <CR>                Begin same  fractal over again
  939. <ESC>               Quit program
  940. Q                  <Q>uit program
  941. W                  <W>rite MIDI event file
  942. R                  <R>hythm toggle (duple/triple)
  943. T                  <T>exture toggle
  944. Y                  <Y> toggle
  945. I                  <I>mprovise toggle
  946. P                  <P>ause
  947. S                  <S>taccato music
  948. L                  <L>egato music
  949. X                  <X> toggle
  950. B                  <B>egin again after pause
  951. N                  <N>ormal music
  952. M                  <M>usic toggle
  953.  
  954.  
  955. Key Pad Keys:
  956.  
  957. UpArrow             Increase pitch offset by 1 (max = 24)
  958. DnArrow             Decrease pitch offset by 1 (min = -12)
  959. PgUp                Increase pitch offset by 12 (max = 24)
  960. PgDn                Decrease pitch offset by 12 (min = -12)
  961. Home                Tempo increase by 10 bpm (max = 250 bpm)
  962. End                 Tempo decrease by 10 bpm (min =  40 bpm)
  963. LftArrow            Map to previous scale (1 < scale < 21)
  964. RtArrow             Map to next scale
  965.  
  966. <CTRL> UpArrow      Increase compression factor by 1 (max = 1000)
  967. <CTRL> DnArrow      Decrease compression factor by 1 (min = 1)
  968. <CTRL> PgUp         Increase compression factor by 10
  969. <CTRL> PgDn         Decrease compression factor by 10
  970. <CTRL> Home         Increase compression factor by 100
  971. <CTRL> End          Decrease compression factor by 100
  972. <CTRL> 5            Toggle trace mode
  973.  
  974.  
  975.                               Release History
  976.  
  977.  
  978. 10/93
  979. v 1.0 - 1.99: Not publically released. No title. Just testing the concept.
  980. Twenty-one scale types. Improvise mode, legato, normal, staccato music;
  981. offset by half-tone as well as by octave. Four fractal types. Music toggle.
  982. Restart and Next functions.
  983.  
  984. 11/14/93
  985. v 2.0 - Title was given; corrected logic error in the musical algorithm
  986. (oops!); 20 symmetry functions were added; code was tightened up and made
  987. modular for later expansion; tempo control was added. First public release.
  988.  
  989. 12/29/93
  990. v 2.3e - The <sh>1 or ! symmetry operator was originally identical to the
  991. unaltered fractal. This was changed to the inverse of the fractal, i.e.
  992. (x,y) -> (-x,-y). The Chebyschev, Ikeda, Julia, and Ivanov fractals were
  993. added as well as symmetrical icons from the book Symmetry in Chaos by Field
  994. and Golubitsky and the Duffing Attractor. Triplet rhythm was added as well.
  995. The version number now appears on screen. Sincere thanks is due to Oleg
  996. Ivanov of Moscow, Russia, for contributing the code for the Ivanov fractal.
  997. Texture toggle was added.
  998.  
  999. 5/31/95
  1000. v. 3.0 - Many new features. Midi event files can be written. Chebychev
  1001. fractal was greatly improved by carefully controlling the parameter
  1002. choices. Title screen added. Control summary and status boxes on screen
  1003. were written with smaller font to include more information. Data
  1004. compression was added. X,Y musical component toggle added. <B>egin and
  1005. <P>ause functions added. Trace mode added to accompany music in
  1006. conjunction with data compression. Documentation greatly expanded.
  1007.  
  1008. Known bugs: The <T>exture mode does not always work well with one or two of
  1009. the fractal types such as Chebychev. I haven't been able to figure out the
  1010. reason, but it really is cosmetic and has nothing to do with the main
  1011. purpose of the program. I will work on it for the next version.
  1012.  
  1013.  
  1014.                                What's Next?
  1015.  
  1016. 1. Expanded tempo range.
  1017. 2. Selective X/Y offset and octave.
  1018. 3. Improved user interface (menus).
  1019. 4. More mapping schemes.
  1020. 5. Expanded tutorial.
  1021. 6. More examples of Midi files.
  1022. 7. Other fractal types.
  1023. 8. Other symmetry operators.
  1024. 9. Full screen option for experienced users who don't need the command
  1025.    summary.
  1026. 10.Suggestions sent by users?
  1027.  
  1028.  
  1029.  
  1030.                              Registration Deal
  1031.  
  1032. The previous versions of the Well-Tempered Fractal were experimental toys
  1033. for amusement. I believe that I have shown that version 3 is a useful
  1034. creative tool and I would like to encourage users to register, mainly so
  1035. that I can know who is using the program and what they are doing with it. I
  1036. will therefore offer two options for registration:
  1037.  
  1038. Option 1:
  1039.           $15 registration fee gets you the Postscript version of
  1040.           the manual on disk and a bonus tutorial complete with
  1041.           illustrations of the fractals and sample score notation. Your
  1042.           name will be entered in my database and I will notify you of the
  1043.           next upgrade and tell where you can get a copy by ftp.
  1044.  
  1045. Option 2:
  1046.           Send no money, but instead send me
  1047.  
  1048.           1. an image (.GIF, .PCX, .JPG, etc.) of a fractal screen capture
  1049.  
  1050.           2. the corresponding raw data Midi event file produced from the
  1051.              fractal
  1052.  
  1053.           3. a finished Midi arrangement of your composition (.MID file)
  1054.  
  1055.           4. permission to distribute what you send me as an example of
  1056.              what can be done with the program.
  1057.  
  1058.           You will be listed as the composer and copyright holder of the
  1059.           work. In return you will receive the manual and bonus tutorial
  1060.           and notification of where to get the next upgrade.
  1061.  
  1062. I welcome comments, bug reports and suggestions for future modifications.
  1063.  
  1064. Robert Greenhouse
  1065. robert.greenhouse@spacebbs.com
  1066.  
  1067.  
  1068.                              Registration Form
  1069.  
  1070. Name________________________________________________________________________
  1071. Address_____________________________________________________________________
  1072.        _____________________________________________________________________
  1073.        _____________________________________________________________________
  1074. E-mail______________________________________________________________________
  1075.  
  1076. Where did you get the WTF30?________________________________________________
  1077.  
  1078. Registration option (circle one):
  1079.  
  1080. Option 1:
  1081.  
  1082.         Enclosed is a check for US $15. In return I will receive the
  1083. Postscript version of the manual and bonus tutorial and will be notified
  1084. where and how to get the next upgrade of WTF.
  1085.  
  1086. Option 2:
  1087.  
  1088.         I enclose no money, but instead:
  1089.  
  1090. 1. An image file (.GIF, .PCX, .JPG) of a fractal generated with WTF30
  1091. 2. The Midi event file generated by WTF30 from the same fractal
  1092. 3. A Midi file with a composition I have composed and arranged from the
  1093. same Midi event file
  1094. 4. I give you permission to distribute the image, event file and Midi
  1095. arrangement as long as you include my name as the copyright holder of the
  1096. arrangement.
  1097.  
  1098. In return I will receive the Postscript version of the manual and bonus
  1099. tutorial and will be notified where and how to get the next upgrade of WTF.
  1100.  
  1101. Mail to:
  1102.  
  1103. Robert Greenhouse
  1104. 3401 Hillview Ave
  1105. Palo Alto, California
  1106. 94304 (USA)
  1107.