Mandel.csd - new version?

Hello all! I’m a new user of csound within Max MSP. My project is a musicalisation of the Mandelbrot set.

Running the example mandel.csd does produce a musical phrase. However, the opcode is not contained within the example file. I assume then that this musical phrase cannot be said to be fractal…and what actually is it about this code which makes it a representation of the Mandelbrot set?

I discovered this discussion on github csound, which puts forward an alternative code. What makes this code fractal / a better Mandelbrot representation than the original?

I also experimented with changing Kx/ky/maxIter…but get no results. Actually I don’t know what the parameter range is / could be.

Does anyone know of any other attempts to update mandel.csd? Or have any pointers.

Thank you!

I think the fact it actually uses the mandel opcode make it a better representation than the original, which as you say doesn’t even use that opcode.

Can you post a sample .csd file?

Finally, on the github issues page you ask why use p8, p3, and p9. Parameter-fields (p-fields) are used to pass data from a score to an instrument. So if you want to pass different values to your instrument you can do so by changing the score rather than the instrument code.

all true…the example of mandel in mandel example does not contain use of mandel · Issue #525 · csound/manual · GitHub is nice in that it uses the mandel opcode. The old example does not.
But mandel is still shrouded in mysteries (i believe this is the right expression?) and AsterixMusic is trying to get his head around this.

The opcode was written by Gabriel Maldonado, but we were so far unable to contact him for further explanation.
So this is still a work in progress…

If you are experimenting with mandel and do get some decent result, please share them here or in that issue mandel example does not contain use of mandel · Issue #525 · csound/manual · GitHub.

Thank you both for your comments!

I will proceed with some experiments and report back.

Where can I connect with AsterixMusic?

1 Like

Hello, I’m here… AsterixMusic
Still investigating Mandelbrot, I don’t know what “Mandel” opcode exactly do…

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

Here’s the lowdown on formatting :slight_smile:

1 Like

Nice example btw. I put some comb filers on the reverb signal for the laugh, also sounded quite nice to my ears. :slight_smile:

1 Like

Thanks. BTW, to anyone that reads this far, can you spot the noob mistake? I was originally using a transegr envelope. Realizing I didn’t need it I removed it from the wgpluck. But forgot to delete the line…

What a nice example this would be for the mandel opcode!
Can we use this example and add it as a mandel opcode example to the manual?
Including the “; example by Scott Daughtrey [ST Music]”

1 Like

Absolutely, of course, I feel honoured and flattered at such a request. For others reading I will try to update the file with a few lines to explain some things. Any questions are welcome, being a newbie to Csound I’m still aware that it poses quite a steep initial learning curve.

A quick note: it would appear the pitches used in the score of the original example were likely derived from mandelbrot. The unfortunate part is this is not clear. It would be too easy to selectively choose and reorder the output of the equation and therefore may not be an accurate reflection of the opcode itself. Just a personal thought.

great!
This example is fun i think.
and makes me want to tweak a bit the mandel parameters to find out what will happen when i do.

I copypasted your example as is, to the issue mandel example does not contain use of mandel · Issue #525 · csound/manual · GitHub. Other people (like me) might react to this csd.
I hope to be able look into this coming weekend.

If you are willing to add a few more comments, can you post this new csd here or in the github issue please?

1 Like

It would interesting to research. If one could find some zoomed in pictures that also listed the coordinates that would be very useful. I suspect they would be very fractional like X=-0.1342 and Y=.9145 (I’m just making those up).

Without some reference it might be quite likely to end up with nothing but min and/or max iterations and nothing in between. Or at least that’s the impression I get from what little I understand.

If you could find useful coordinate areas things like lines or navigating them with other methods to obtain X and Y values could provide some interesting results. Here is a slightly updated csd:
mandel_st.csd (1.8 KB)
Feel free to forward this to the github forum of you can, I’m new there and still a little unfamiliar with how to format posts there.

A nice example for the manual for sure.

Quick follow up, here some pictures of areas in the Mandelbrot with listed coordinates:
http://www.cuug.ab.ca/dewara/mandelbrot/images.html

And this online tool allows you to zoom in and also gives the XY coordinates:

2 musical examples form Scott and Michael have been added to the manual page, also an example from Stefano.
And an image with X and Y axis.
https://csound.com/manual/mandel.html
Thankss for the examples!

1 Like

You’re welcome. It’s funny but nice seeing my name/example on the site. I’m glad to be able to make a contribution.

Scott

1 Like

@Rory I’m using the Android app. I looked at the video for formatting but noticed the </> button is not automatically visible in the toolbar, to access this option I have to click on a gear icon. There are other options there like bulleted list etc. as well.

Just pointing that out in case you ever come across another Android user having issues.