Fractal Sound
This is part of a c++ program which in it's day
drew a mandelbrot fractal and made some nice fractal
noise.
void mandelbrot::init(double aa,double bb,
double cc,double dd,
double rp,double ip,
double RR, int nnumits,
int sstartx,int sstarty,
int ww,int ddp)
{
a = aa;b = bb;c = cc;d = dd;
R = RR;
numits = nnumits;
startx = sstartx;
starty = sstarty;
w = ww;
dp = ddp;
realp = rp;
imagp = ip;
}
void mandelbrot::iterate()
{
long int p,q;
int n;
double k,l,x,y,newx,newy;
for (p = 1; p < w; p++)
{
for (q = 1; q < dp; q++)
{
k = (double)a+(c-a)*p /(w);
l = (double)b+(d-b)*q / (dp);
x = realp;
y = imagp;
for (n = 1; n < numits; n++)
{
newx = x*x-y*y+k;
newy = 2*x*y+l;
x = newx;
y = newy;
sound((unsigned int)(y*x*5000+440));
putpixel(x*10+160,y*10+100,(unsigned char)n);
if (x*x+y*y>R)
{
putpixel(p+startx-1,q+starty-1,n);
n = numits;
}
if (bioskey(1)>0)
{
nosound();
n = numits;
q = dp;
p = w;
}
}//n
}//p
}//q
}
You can grab the code and modify it to see if you can make it work!