17 Etudes, Op. 6: Sonification of Chaos

Example 17-1. The Logistic Map as key numbers

(define (logmap chaos len rate dur key1 key2 amp)
  (let ((y (random 1.0))
        (k 0))
    (process repeat len
             set y = (* y chaos (- 1 y))
             set k = (rescale y 0 1 key1 key2)
             output (new midi time (now)
                         :keynum k 
                         :duration dur
                         :amplitude amp)
             wait rate)))

Interaction 17-1. Listening to the Logistic Map

cm> (events (logmap 3.7 200 .125 .25 60 96 .6) "logmap.mid")
"logmap-1.mid"
cm> (events (logmap 3.99 200 .125 .25 60 96 .6) "logmap.mid")
"logmap-2.mid"
cm>

Example 17-2. Chaotic rhythms

(define (groove chaos len pulse)
  (let ((y (random 1.0)))
    (process repeat len
             set y = (* y chaos (- 1 y))
             output (new midi :time (now)
                         :keynum 60
                         :duration .01)
             wait (* pulse y))))

Interaction 17-2. Listening to the Logistic Map

cm> (events (groove 3.99 50 .5) "logmap.mid")
"logmap-3.mid"
cm>

Example 17-3. Two dimensional Logistic Map

(define (logmap-2d chaos len pulse key1 key2 dur)
  (let ((y (random 1.0)))
    (process repeat len
             set y = (* y chaos (- 1 y))
             output (new midi :time (now)
                         :keynum (rescale y 0 1 key1 key2)
                         :duration dur)
             wait (quantize (rescale y 0 1 0 pulse) .1))))

Interaction 17-3. Listening to logmap-2d

cm> (events (logmap-2d 3.99 200 .125 60 96 1) "logmap.mid")
"logmap-4.mid"
cm>

Example 17-4. Henon Mapping

(define (henon1 len rate dur key1 key2)
  (let ((x 0)
        (y 0))
    (process repeat len
             for z =  (- (+ y 1) (* .2 x x))
             set y = (* .99 x)
             output (new midi :time (now)
                         :keynum (rescale y -5 5 key1 key2)
                         :duration dur)
             wait (rescale z -5 5 0 rate)
             set x = z)))

(define (henon2 len rate key1 key2)
  (let ((x 0)
        (y 0) 
        (k 0)
        (r 0))
    (process repeat len 
             for z = (- (+ y 1) (* .2 x x))
             set y = (* .99 x)
             set k = (rescale y -5 5 key1 key2)
             set r = (rescale z -5 5 0 .4)
             output (new midi :time (now)
                         :keynum k
                         :duration r)
             sprout (new midi :time (+ (now) rate)
                         :keynum k
                         :duration .05)
             wait (+ rate r)
             set x = z)))

Interaction 17-4. Listening to Henon Mapping

cm> (events (henon1 250 .24 1 48 84) "henon.mid")
"henon-1.mid"
cm> (events (henon2 250 .25 48 84) "henon.mid")
"henon-2.mid"
cm>

Chapter Source Code

The source code to all of the examples and interactions in this chapter can be found in the file chaos.cm located in the same directory as the HTML file for this chapter. The source file can be edited in a text editor or evaluated inside the Common Music application.