back to list

Converting the Mandelbrot set into sound

🔗Mats Öljare <oljare@...>

7/22/2008 6:36:03 AM

There have been various attempts to convert the Mandelbrot set into
sound, more or less unsuccessful. However there is one way which i
have recently thought of, and i don't know if it has been tried.
Basically, it requires the image to be calculated to a very high
resolution-about 40 000 pixels wide for each second of sound. Each
sample would represent one "line" of pixels, either horizontal or
vertical, the number of "black"versus "white" pixels becoming the
value for the sample. It seems this might produce listenable sounds,
possibly even harmonically complex, but i'm not sure. Does anyone know
if this has been tried, or have the programming skills and tools to
try to implement this?

🔗Jon Szanto <jszanto@...>

7/22/2008 9:08:31 AM

Mats,

Listenable sounds? Hmmm, possible, but... I've never believe there is
*any* kind of correlation between a compelling visual image and a
compelling sound image that can be extrapolated from it. And I've
never heard Mandelbrots made into any kind of 'music' that would
interested me a second (or even complete first) time.

I don't know if you've used Coagula, which was a free app that still
sits out there on the web somewhere. This guy wrote and interesting
program that processes image, translating colors and position into
pitch, time, and stereo placement. I've used it occasionally to
generate background audio landscapes, but can't say that any could
reasonably stand on their own. But if you haven't seen/used it,
certainly worth looking for.

Cheers,
Jon

--- In MakeMicroMusic@yahoogroups.com, Mats Öljare <oljare@...> wrote:
>
> There have been various attempts to convert the Mandelbrot set into
> sound, more or less unsuccessful. However there is one way which i
> have recently thought of, and i don't know if it has been tried.
> Basically, it requires the image to be calculated to a very high
> resolution-about 40 000 pixels wide for each second of sound. Each
> sample would represent one "line" of pixels, either horizontal or
> vertical, the number of "black"versus "white" pixels becoming the
> value for the sample. It seems this might produce listenable sounds,
> possibly even harmonically complex, but i'm not sure. Does anyone know
> if this has been tried, or have the programming skills and tools to
> try to implement this?
>
> /Ö
>

🔗Carl Lumma <carl@...>

7/22/2008 10:54:59 AM

At 06:36 AM 7/22/2008, you wrote:
>There have been various attempts to convert the Mandelbrot set into
>sound, more or less unsuccessful. However there is one way which i
>have recently thought of, and i don't know if it has been tried.
>Basically, it requires the image to be calculated to a very high
>resolution-about 40 000 pixels wide for each second of sound. Each
>sample would represent one "line" of pixels, either horizontal or
>vertical, the number of "black"versus "white" pixels becoming the
>value for the sample. It seems this might produce listenable sounds,
>possibly even harmonically complex, but i'm not sure. Does anyone know
>if this has been tried, or have the programming skills and tools to
>try to implement this?
>
>/Ö

Most of the fractal music attempts I know of try to turn fractals
into notes, not into waveforms. However, if you don't need the
picture for anything, it should be fairly easy. In Mathematica
or Maple, I believe you can save arrays of numbers to PCM wave
files, and the math part is only a couple lines of code.

By the way, there's something called "scanned synthesis"

http://en.wikipedia.org/wiki/Scanned_synthesis

which fits with some of your ideas, like the one about audifying
waves on a water surface and perhaps even this one. For instance,
you could take a segment of the Mandelbrot set boundary and scan
it to produce a tone, and then zoom in on the boundary, holding
the number of pixels in the wavetable constant. Or you could
allow the number of pixels to grow by the zoom factor. . .

-Carl

🔗Dave Seidel <dave@...>

7/22/2008 3:34:34 PM

I have a couple of pieces that are based on cellular automata. I used them to determine the harmonic structure of the waveforms, as opposed to pitch. They're written with Csound, using blue's python scripting ability. All the code is there, so maybe you can get ideas from what I did.

http://mysterybear.net/article/22/owllight
http://mysterybear.net/article/23/palimpsest

- Dave

Mats �ljare wrote:
> There have been various attempts to convert the Mandelbrot set into
> sound, more or less unsuccessful. However there is one way which i
> have recently thought of, and i don't know if it has been tried.
> Basically, it requires the image to be calculated to a very high
> resolution-about 40 000 pixels wide for each second of sound. Each
> sample would represent one "line" of pixels, either horizontal or
> vertical, the number of "black"versus "white" pixels becoming the
> value for the sample. It seems this might produce listenable sounds,
> possibly even harmonically complex, but i'm not sure. Does anyone know
> if this has been tried, or have the programming skills and tools to
> try to implement this?
> > /�

🔗Jon Szanto <jszanto@...>

7/22/2008 4:57:30 PM

--- In MakeMicroMusic@yahoogroups.com, Dave Seidel <dave@...> wrote:
>
> I have a couple of pieces that are based on cellular automata.

I'll have a look/listen - CA and I go back to Conway's original "Life"
article in Scientific American when I was in high school... uh...
*years* ago!

People might or might not remember Carl and/or I posting about Wolfram
doing CA music interactively:

http://tones.wolfram.com/

Cheers,
Jon

🔗Mats Öljare <oljare@...>

7/23/2008 3:16:13 PM

As i should have stated clearly enough from the start, what i'm
suggesting is generating sound waves out of the shape, not mapping it
to pitches. The idea is that the amount of small details in it would
result in enough high frequencies to be audible, even at very slow speeds.

The problem is that to realize this, i would need VERY large picture
of it, at least 40 000 pixels wide, just for a one-second version,
preferably millions of pixels, as well as software capable of handling
it. If someone can make a simple 2-color BMP of the Mandelbrot set in
such a high resolution, i might be able to make the conversion to
audio myself.

I also started threads on it here:
http://acapella.harmony-central.com/forums/showthread.php?t=2045446
/cnfractal_music/messages

🔗Carl Lumma <carl@...>

7/23/2008 3:37:36 PM

--- In MakeMicroMusic@yahoogroups.com, Mats Öljare <oljare@...> wrote:
>
> As i should have stated clearly enough from the start, what i'm
> suggesting is generating sound waves out of the shape, not mapping
> it to pitches.

Yes, I think I said that. Did you look into scanned synthesis?

> The problem is that to realize this, i would need VERY large
> picture of it, at least 40 000 pixels wide, just for a one-
> second version, preferably millions of pixels, as well as
> software capable of handling it. If someone can make a simple
> 2-color BMP of the Mandelbrot set in such a high resolution,
> i might be able to make the conversion to audio myself.

If you don't care about looking at the picture, you don't need
to generate the picture. If you're just doing black or white
(i.e. you're just looking at set membership and not escape
times), then that's a single bit per per pixel, or about 200MB
for a 40,000 x 40,000 set. If you do 20 iterations per point
(and you probably wouldn't need that many), that's on the order
of 32 Gops. A 3GHz quad-core Xeon chip from Intel can do
80 GFLOPS. So your project is well within range of today's
hardware.

If you could calculate audio from a bmp, you can generate
the mandelbrot in the first place. In fact I would tally
the value for the waveform inside the loop for the mandelbrot
so you don't have to store and parse that 200MB file.

-Carl

🔗jorge blank <jorgepiaget@...>

7/29/2008 6:08:58 AM

Hey there

I am a long time lurker, first time poster.

anyhow, if you want to convert the Mandelbrot set into sound, why not
start with the functions involved (might be easier to try some simpler
self-similar sets first like Serpinski Triangles or something) and
apply the results of those functions directly onto a set of audio
data, or utilize them to generate audio directly? It seems to me that
this is a more direct approach since the mathematical language
functions in this case as THE missing link between the picture and the
intended sounds. Maybe the time domain could represent what happens
as one transitions from one order of magnitude (level of organization)
to the next, and the frequency and amplitude material of the sound
could reflect various solutions to the function.

You don't have to know so much math to approach these things as tables
of numerical data relating to the solutions of these types of things
are available, probably even on the internet. I am certainly no math
whiz and yet I have sort of been working on things conceptually
adjacent to this for a while with interesting results.

cheers!

Jorge Boehringer

www.virb.com/coal

🔗Mats Öljare <oljare@...>

7/29/2008 6:37:40 AM

I'm currently working on a program to do this myself. However, the
only language i know and have is QBasic, which is terribly and
unnecessarily slow for this kind of operation. For those who are
curious, this is my current solution, it would take hours or possibly
days to complete as it is now though, and still probably give a
disappointing result.

So does anyone have a suggestion for a freeware version of BASIC i
should try instead, that is compatible with the same expressions and
calculates at full speed?

OPEN "c:\_" + STR$(INT(TIMER / 10)) + ".raw" FOR OUTPUT AS #1

SCREEN 12
LINE (0, 0)-(640, 480), 1, BF
FOR m = 511 TO 1 STEP -.0003
l = 32766
FOR n = 41 TO 256 STEP .2
p = (m - 420) / 200
q = (n - 256) / 200
x = 0
y = 0
FOR i = 1 TO 80
u = x * x - y * y + p: v = 2 * x * y + q: IF u * u + v * v > 4 GOTO E
x = u: y = v: NEXT i
PSET (m, n), 15
l = l + 1
E:
NEXT n
PSET (m, 1), 15
PRINT #1, CHR$(INT(l / 256)); CHR$(l MOD 256);
NEXT m

🔗Graham Breed <gbreed@...>

7/29/2008 6:54:00 AM

2008/7/29 Mats Öljare <oljare@hotmail.com>:
> I'm currently working on a program to do this myself. However, the
> only language i know and have is QBasic, which is terribly and
> unnecessarily slow for this kind of operation. For those who are
> curious, this is my current solution, it would take hours or possibly
> days to complete as it is now though, and still probably give a
> disappointing result.

So how about learning a more appropriate language? Java should do it.
If you held out with QBasic this long it's going to be a once in a
decade effort after all.

Or, if you use QBasic, turn off the graphical output. It probably
uses old BIOS routines that are hideously slow.

> So does anyone have a suggestion for a freeware version of BASIC i
> should try instead, that is compatible with the same expressions and
> calculates at full speed?

There are all kinds of tricks the advanced programs use to speed up
the calculation. One is to detect when you're definitely inside the
set. You can see that a certain radius around the origin is always
inside, and as soon as a point gets in there you can move on. You can
also check for limit cycles, follow edges, and other things that you
won't want to program yourself. These optimizations may be more
important than the choice of library. So try to find a library, or
maybe get Xaos to write out an image and read it in with your program.

You'll probably still get a disappointing result. Have you looked at
Chua's oscillator?

Graham

🔗Graham Breed <gbreed@...>

7/29/2008 12:07:33 PM

I wrote:
> the calculation. One is to detect when you're definitely inside the
> set. You can see that a certain radius around the origin is always
> inside, and as soon as a point gets in there you can move on. You can

That's wrong, of course, because you always start at the origin. So
instead you have to check that one result looks very similar to the
previous, so that it's converging. And you can get it wrong but you
can always get things wrong. If you have a large part of the interior
this can make a lot of difference to the run time -- I experimented
with all of this in my mis-spent youth.

And another thing ... if you detect a solution or overflow you also
have the number of steps it took and, if your code's smart enough, the
order of the solution. That's often used for the coloration but for
music could obviously be an intensity. Hence you can get something a
bit more interesting than a plain on/off for inside/outside.

Graham

🔗Aaron Krister Johnson <aaron@...>

7/29/2008 6:34:50 PM

I advocate Python where possible b/c it's easy to learn, and for many
tasks, fast enough.

There is apparantly a relitively fast code snippet for the Mandelbrot
set here:

http://www.daniweb.com/code/snippet621.html

....and I'm sure you could hack it to turn it into sound with the
appropriate ingenuity.

-AKJ.

--- In MakeMicroMusic@yahoogroups.com, Mats Öljare <oljare@...> wrote:
>
> I'm currently working on a program to do this myself. However, the
> only language i know and have is QBasic, which is terribly and
> unnecessarily slow for this kind of operation. For those who are
> curious, this is my current solution, it would take hours or possibly
> days to complete as it is now though, and still probably give a
> disappointing result.
>
> So does anyone have a suggestion for a freeware version of BASIC i
> should try instead, that is compatible with the same expressions and
> calculates at full speed?
>
> OPEN "c:\_" + STR$(INT(TIMER / 10)) + ".raw" FOR OUTPUT AS #1
>
> SCREEN 12
> LINE (0, 0)-(640, 480), 1, BF
> FOR m = 511 TO 1 STEP -.0003
> l = 32766
> FOR n = 41 TO 256 STEP .2
> p = (m - 420) / 200
> q = (n - 256) / 200
> x = 0
> y = 0
> FOR i = 1 TO 80
> u = x * x - y * y + p: v = 2 * x * y + q: IF u * u + v * v > 4 GOTO E
> x = u: y = v: NEXT i
> PSET (m, n), 15
> l = l + 1
> E:
> NEXT n
> PSET (m, 1), 15
> PRINT #1, CHR$(INT(l / 256)); CHR$(l MOD 256);
> NEXT m
>

🔗Kraig Grady <kraiggrady@...>

7/30/2008 1:31:17 AM

One way is to look at the mandlebrot set and imitate what you see musically using your imagination. what impression things make are often more interesting that some over clinical transposition.

/^_,',',',_ //^ /Kraig Grady_ ^_,',',',_
Mesotonal Music from:
_'''''''_ ^North/Western Hemisphere: North American Embassy of Anaphoria Island <http://anaphoria.com/>

_'''''''_ ^South/Eastern Hemisphere:
Austronesian Outpost of Anaphoria <http://anaphoriasouth.blogspot.com/>

',',',',',',',',',',',',',',',',',',',',',',',',',',',',',

Aaron Krister Johnson wrote:
>
> I advocate Python where possible b/c it's easy to learn, and for many
> tasks, fast enough.
>
> There is apparantly a relitively fast code snippet for the Mandelbrot
> set here:
>
> http://www.daniweb.com/code/snippet621.html > <http://www.daniweb.com/code/snippet621.html>
>
> ....and I'm sure you could hack it to turn it into sound with the
> appropriate ingenuity.
>
> -AKJ.
>
> --- In MakeMicroMusic@yahoogroups.com > <mailto:MakeMicroMusic%40yahoogroups.com>, Mats �ljare <oljare@...> wrote:
> >
> > I'm currently working on a program to do this myself. However, the
> > only language i know and have is QBasic, which is terribly and
> > unnecessarily slow for this kind of operation. For those who are
> > curious, this is my current solution, it would take hours or possibly
> > days to complete as it is now though, and still probably give a
> > disappointing result.
> >
> > So does anyone have a suggestion for a freeware version of BASIC i
> > should try instead, that is compatible with the same expressions and
> > calculates at full speed?
> >
> > OPEN "c:\_" + STR$(INT(TIMER / 10)) + ".raw" FOR OUTPUT AS #1
> >
> > SCREEN 12
> > LINE (0, 0)-(640, 480), 1, BF
> > FOR m = 511 TO 1 STEP -.0003
> > l = 32766
> > FOR n = 41 TO 256 STEP .2
> > p = (m - 420) / 200
> > q = (n - 256) / 200
> > x = 0
> > y = 0
> > FOR i = 1 TO 80
> > u = x * x - y * y + p: v = 2 * x * y + q: IF u * u + v * v > 4 GOTO E
> > x = u: y = v: NEXT i
> > PSET (m, n), 15
> > l = l + 1
> > E:
> > NEXT n
> > PSET (m, 1), 15
> > PRINT #1, CHR$(INT(l / 256)); CHR$(l MOD 256);
> > NEXT m
> >
>
>

🔗Mats Öljare <oljare@...>

7/30/2008 7:26:35 AM

Well, i've managed to make a more efficient version ,but the result is
rather disapponting. I guess it's basically just noise, though it has
some interesting structural properties. For those who still want to
hear it, i uploaded a brief resulting file here, along with one of the
Julia set for -1.

http://rapidshare.com/files/133586839/mandel.zip.html

🔗John Starrett <jstarret@...>

7/30/2008 8:45:03 PM

--- In MakeMicroMusic@yahoogroups.com, Mats Öljare <oljare@...> wrote:
>
> As i should have stated clearly enough from the start, what i'm
> suggesting is generating sound waves out of the shape, not mapping it
> to pitches. The idea is that the amount of small details in it would
> result in enough high frequencies to be audible, even at very slow
speeds.

One thing you could try is to use points in the set (the boundary) as
a source of complex coefficients for a Fourier synthesized waveform.
Start with a chaotic orbit or periodic orbit on the boundary and let
the real parts p_1, p_2,...,p_n,... for n=1,2,...k be the coefficients
of the k cosine terms of the form cos(2 pi n x), and the imaginary
parts q_1, q_2,...,q_n,... for n=1,2,...k be the coefficients of the
sine terms sin(2 pi x). Then each periodic orbit {p_n + q_n i} would
generate a different timbre
p_1 cos(2 pi 1 x)+q_1 sin(2 pi 1 x) +
p_2 cos(2 pi 2 x)+q_2 sin(2 pi 2 x) +
p_3 cos(2 pi 3 x)+q_3 sin(2 pi 3 x) + ...
.
.
. +
p_k cos(2 pi k x)+q_k sin(2 pi k x)

Alternately, one could use a moving window to build a continuously
changing timbre as the Fourier coefficients sweep through a table of
the real and imaginary parts of a chaotic orbit.

In a different vein, in order to get a true function from the
Mandelbrot set, you could take the convex hull of the computed
boundary as the waveform outline. I am pretty sure that both Maple and
Matlab can compute these from a set of points.

John Starrett

🔗Mats Öljare <oljare@...>

7/31/2008 2:37:49 PM

> Alternately, one could use a moving window to build a continuously
> changing timbre as the Fourier coefficients sweep through a table of
> the real and imaginary parts of a chaotic orbit.

No, i really don't get what you mean at all, though you should try
realizing that yourself, if you think it's a good idea.

/Ö