;
;; Sonification and Chaos (see chaos.html)
;
; The logmap process maps values from the Logistic Map onto key
; numbers between key1 and key2. The initial conditions f0 are
; represented by the specified chaos parameter, which may range
; between 0 less than 4.0, and the initial value for y.
process logmap (chaos, y, len, rate, dur, key1, key2, amp)
repeat len
for k = rescale( y, 0, 1, key1, key2)
mp:midi(key: k , dur: dur, amp: amp)
wait rate
set y = (y * chaos * (1 - y))
end
;
;; listen to it!
;
begin
with c = 3.7, y = random(1.0)
sprout(logmap( c , y, 200, .125, .25, 60, 96, .6))
end
; increase the chaos factor close to the maximum:
begin
with c = 3.99, y = random(1.0)
sprout(logmap(c, y, 200, .125, .25, 60, 96, .6))
end
; listen to two voices diverging
begin
with c = 3.75
sprout(list(logmap(c, .95, 200, .125, .25, 60, 96, .6),
logmap(c, .9499999, 200, .125, .25, 60, 96, .6)))
end
; This example maps chaotic rhythms:
process groove(chaos, len, pulse)
with y = random( 1.0)
repeat len
mp:midi(key: 60, dur: .01)
wait pulse * y
set y = y * chaos * (1 - y)
end
sprout(groove(3.99, 50, .5))
; In this example we link both rhythms and pitches together to form
; more distinctive sonic gestures. The rhythms are quantized to
; increments of .1.
; Two dimensional Logistic Map
process logmap-2d (chaos, y, len, pulse, key1, key2, dur)
repeat len
for k = rescale( y, 0, 1, key1, key2)
for d = quantize( rescale( y, 0, 1, 0, pulse), .2)
mp:midi(key: k, dur: dur)
wait d
set y = y * chaos * ( 1 - y)
end
begin
with y = random(1.0)
sprout(logmap-2d( 3.99, y, 200, .5, 60, 96, 1))
end
;
;; Henon Map
;
; The formula for calculating values in the Henon Map is:
; x[n+1] = 1 + ax[n]^2 + by[n]
; y[n+1] = x[n]
; We can define a function that does this for us, it takes an old x y
; "point" (a list of 2 numbers) and returns a new point representing
; the new x and y values
function henon(poi, a, b)
with oldx = poi[0],
oldy = poi[1],
newx = 1 + (a * oldx * oldx) + (b * oldy),
newy = oldx
list(newx, newy)
end
;Good choices for alpha and beta:
; a b x y
; -1.56693 0.003937 0.189406 0.18940
; 0.42 -0.999
; 0.22 -0.999
; 0.22 -1.0
; -0.989 0.51
; -1.191 0.31
; -1.595 0.21
; -1.4 0.3
process playhemap(num, rhy, dur, lok, hik, a, b, x, y, amp)
for i below num
for poi = list(x,y) then henon(poi,a,b)
for k = rescale( poi[0], -1, 1, lok, hik)
mp:midi(dur: dur, amp: amp, key: k)
wait rhy
end
sprout(playhemap(100, .125, .25, 30, 100,
-1.56693,
-0.011811,
0.0,
0.0,
.7))
; this is like playhemap except that it only plays notes that lie
; within the low/high keynum range. this give the algorithm some
; rhythmic interest (Craig Sapp)
process playhemap2(num, rhy, dur, lok, hik, a, b, x, y, amp)
for i below num
for poi = list(x,y) then henon(poi,a,b)
for k = rescale( poi[0], -1, 1, 0, 127)
if ( (k >= lok) & (k <= hik) )
mp:midi(dur: dur, amp: amp, key: k)
end
wait rhy
end
sprout(playhemap2(200, .125, .25, 30, 100,
-1.56693,
-0.011811,
0.0,
0.0,
.7))
;; try other values for alpha and beta!