Csound Csound-dev Csound-tekno Search About

Mandelbrot Set Orchestra & Score

Date1997-10-10 12:46
FromHans Mikelson
SubjectMandelbrot Set Orchestra & Score
Greetings Fellow Csounders,

This instrument is based on the mandelbrot set.  It basically scans back
and forth across the set.  Where the number of iterations is usually
interpreted as a color in this case it is interpreted as an amplitude.
Making an audio oscillator out of the mandelbrot set.  I finally got around
to converting this from some C-code I wrote a while ago.

Set XStep to zero for a constant waveform.  Make XStep a very small value
for a slowly evolving waveform and a big value to make it scan the entire
set quickly.  Most sounds are buzzy and have narrow pulses reminiscent of a
bug being caught in a bug zapper.  Zooming in on certain areas may be able
to produce a variety of interesting waveforms.

Bye,
Hans Mikelson

; Mandelbrot Set Orchestra
; by Hans Mikelson

sr=44100
kr=22050
ksmps=2
nchnls=2

          instr  10

  idur    =      p3
  iamp    =      p4
  ifqc    =      cpspch(p5)
  kxtrace init   p6
  kytrace init   p7
  kxstep  init   p8
  kystep  init   p9*ifqc/55  ; Make scan area independent of frequency.
  ilpmax  init   p10
  kclk    init   1
  aout2   init   0
  kcntold init   0
  kdy     init   1

  kfco    linseg 200, idur*.3, 5000, idur*.2, 300, idur*.2, 1000, idur*.3,
10000

  kclkold =      kclk
  kclk    oscil  1, ifqc, 2    ; Clock
  kdclick linseg 0, .001, iamp, idur-.002, iamp, .001, 0
  
  kcount = 0
  kx     = 0
  ky     = 0

mandloop:      ; Iteration for calculating the Mandelbrot Set.

  kxx = kx*kx-ky*ky+kxtrace
  kyy = 2*kx*ky+kytrace
  kx  = kxx
  ky  = kyy
  kcount = kcount + 1

if ((kx*kx+ky*ky<4) && (kcount