Hello all. I’m relatively new here and to Csound, very new to programming (Csound is my first attempt to programming anything) but was largely drawn to Csound for its ability to create semi-randomized music. Controlled chaos. I was Googling the mandel opcode and came across this thread so thought I’d give it a try.
I know very little about fractals. From looking at pictures of the Mandelbrot it doesn’t exactly look like the most fertile ground (but I may be mistaken), it seems like primarily a bunch of space with a few small patterns here and there. So picking picking X and Y coordinates that won’t keep giving the same iteration does not seem simple.
I have no idea how one would zoom in as I’ve seen in pics to perhaps get much for interesting and perhaps scalable stuff.
I based my choices on this image:
I used trandom, triggered by gausstrig, to set the X values in the range -1.6 and 0, and random to select the Y values between 0 and 1.2.
This area of the upper left quadrant seemed a reasonable place to not simply get only min or max values. Again, knowing nothing about fractals I could be talking out of my hat, I just don’t know.
Then I created a table with 20 note values, somewhat replicating the Canonical example being referenced here. When triggered by the gausstrig, the mandel opcode is sending an int value (iteration) to kIter. That is sent via p5 to instr Mandel. There the table opcode is using the iteration value to select the table index numbers which are notes. So, if I’m doing this right (?) then essentially the gausstrig is determining the timing of notes selected and mandel is choosing which notes to play. In an attempt to add some life to it there’s a little extra randomization with amplitude and panning. I’m not suggesting this is representative of what “Mandelbrot music” should sound like (whatever that is) but it is… something.
P.S. Rory, I can’t figure out using this Csound app how to properly post code so if you feel like reformatting it that would be great. And any pointers on how to properly would be welcome. I’ve also attached the csd as a file.
mandel_st.csd (1.5 KB)
<CsoundSynthesizer>
; formatted for easier viewing on
; mobile devices
<CsOptions>
-odac
; -o/sdcard/mandel.wav ; for Android devices
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 10
nchnls = 2
0dbfs = 1
seed 0
gaRvbL init
gaRvbR init
; table is 5th mode of Hungarian Minor Scale
giNotes ftgen 0, 0, 0, 2, 6.07, 6.08, 6.11, 7.00, 7.02, 7.03, 7.06, \ ; f1 is a pitch table defining a four octave C major scale starting
7.07, 7.08, 7.11, 8.00, 8.02, 8.03, 9.06, \ ; on C two octaves below middle C
8.07, 8.08, 8.11, 9.00, 9.02, 9.03, 9.06, \
9.07
instr Trigger
kTrig = gausstrig(1, 2.35, 1)
kX = trandom(kTrig, -1.6, 0)
kY = randomh(0, 1.2, 10)
kIter, kOutrig mandel kTrig, kX, kY, 21
schedkwhen kOutrig, 0, 0, "Mandel", 0, .7, p4, kIter
endin
instr Mandel
kEnv = transegr(0, .003, 2, .4, .2, -2, 0)
iNote = table(p5, giNotes, 0, 0, 0)
iFreq = cpspch(iNote+p4)
if iFreq == 10.07 then
iFreq = 7.07
endif
iRand = random(.5, .99)
aSig = wgpluck2(iRand, .3*iRand, iFreq, .2, .3)
iPan = random(.2, .8)
aL, aR pan2 aSig, iPan
outs aL, aR
gaRvbL += aL*.3
gaRvbR += aR*.3
endin
instr Reverb
aL, aR reverbsc gaRvbL, gaRvbR, .93, 2^14
outs aL, aR
clear gaRvbL, gaRvbR
endin
</CsInstruments>
<CsScore>
i"Trigger" 0 360 0
i . .1 360 1
i"Reverb" 0 365
e
</CsScore>
</CsoundSynthesizer>
; example by Scott Daughtrey [ST Music]
; https://soundcloud.com/stoons-1
; https://youtube.com/channel/UCGhwmkS1uWmX6mhTIQ0IDsg