'' '' '' '' image to C-sound score '' written by Matthew Conroy, 2005 '' feel free to use, modify or destroy any of this '' '' get the image file$ = open preview dialog$ get quicktime pict size file$,picW,picH resize console 20,50,picW+20,picH+50 load quicktime pict file$ virtu = init screen (0,0,picW+0,picH+0) set screen to virtu cls copyrect 0,0,picW,picH,0,0,picW,picH,0,0,virtu set screen to console cls '' initialize the score file out = open file("file1") fwrite out, "f1 0 8192 10 1" '' time length corresponding to one pixel tquant = 0.1 ' time length of each sound event '' scan the image for x = 0 to picW for y = 0 to picH set screen to virtu get pixel x,y,red,green,blue start = tquant * x ''freq = 10000*100^(-y/picW) '' log freq '' set the frequency of the sound event based on the y-position of the pixel freq = 100 + 9900*((picH-y)/picH) ' linear freq '' set various csound parameters attack = 0.1*tquant release = 0.1*tquant dur = tquant*2 stereo = 0.5 '' may as well be mono ''output score file for Csound if (red+green+blue)>0 then '' don't waste people's time with 0 amp events amp = ((red+green+blue)/65535)^2*300 fwrite out, "i1",start," ",dur," ",amp," ",freq," ",attack," ",release," ",stereo endif next y next x close file out