home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / bit / listserv / fracl / 1375 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.1 KB

  1. Xref: sparky bit.listserv.frac-l:1375 comp.music:6403 sci.fractals:644
  2. Path: sparky!uunet!ulowell!m2c!nic.umass.edu!hamp.hampshire.edu!aalpern
  3. From: aalpern@hamp.hampshire.edu
  4. Newsgroups: bit.listserv.frac-l,comp.music,sci.fractals
  5. Subject: Chaos C code(Was:Re:chaotic modelling)
  6. Message-ID: <1993Jan27.101724.1@hamp.hampshire.edu>
  7. Date: 27 Jan 93 14:17:24 GMT
  8. Distribution: inet
  9. Organization: Hampshire College
  10. Lines: 54
  11. NNTP-Posting-Host: hamp.hampshire.edu
  12.  
  13.  
  14. Here's those code snippets I promised. Apologies for the delay, but all the
  15. computing facilities here at Hampshire were closed yesterday.
  16. The algorithms presented here were taken from Rick Bidlack's 
  17. paper entitled "Chaotic Systems as Simple (But Complex)
  18. Compositional Algorithms. Computer Music Journal Vol. 16
  19. No. 3, Fall 1992, MIT Press
  20.  
  21. Here's a C code snippet for iterating the Henon system.
  22. ITERATIONS is the number of iterations you desire. After about
  23. 80 iterations or so the transients filter out and the system
  24. assumes a chaotic behavior.
  25.  
  26. float     new_iota, new_theta,
  27.         A = 1.43, B = 0.3;        
  28. /* A and B are parameters which determine the orbit */
  29.             
  30. for(counter = 0; counter < ITERATIONS; counter++)    {
  31.     output(iota,theta) /* produce sound, graphics, or whatever */
  32.  
  33.     new_iota = theta + 1.0 - (A*(iota*iota));
  34.     new_theta = B * iota * P;
  35.         
  36.     iota = new_iota;    
  37.     theta = new_theta;
  38. }
  39.  
  40. This is a loop for iterating the Standard Map.
  41.  
  42. float     new_iota, new_theta, K = 1.1;
  43. /* K is the controlling parameter in this system */
  44. for(counter = 0; counter < length; counter++)    {
  45.     output(iota,theta);
  46.     new_iota = iota + (K * sin(theta));
  47.     new_theta = theta + new_iota;
  48.  
  49.     iota = new_iota;
  50.     theta = new_theta;
  51. }
  52.  
  53. Here are some parameter values that will produce a Chaotic 
  54. orbit. For Henon:
  55.     with B = 0.3, use A = 1.076, 1.4, 1.43
  56. For the Standard Map:
  57.     K = 1,1.02,1.1,2.6. Values for K above 1 will usually produce
  58. a chaotic orbit, but there are "windows" of periodicity to
  59. be found too. 
  60.  
  61. In order to produce music from these, one has to figure out a way to 
  62. interpret the results. You could map the results directly to frequency and
  63. delta-time, or mess with them to get something like a scale index.
  64.  
  65. -Adam
  66. aalpern@hamp.hamsphire.edu
  67.