import pitaru.sonia_v2_9.*; PImage img; Sample output; float[] data; void setup() { size(200,200); frameRate(30); Sonia.start(this); img = loadImage("02.jpg"); img.loadPixels(); int numPixels = (img.width*img.height); data = new float[numPixels]; //creates a new array the length of the sample for (int i=0; i < numPixels; i++) { float samp = 0; color argb = img.pixels[i]; int a = (argb >> 24) & 0xFF; int r = (argb >> 16) & 0xFF; // Faster way of getting red(argb) int g = (argb >> 8) & 0xFF; // Faster way of getting green(argb) int b = argb & 0xFF; // Faster way of getting blue(argb) samp = r+g+b; samp /= 3; samp /= 255; samp *= 2; samp -= 1; data[i] = samp; } output = new Sample(numPixels); output.write(data); // write the data from the 'data' array into the sample output.setRate(44200); output.play(); //output.saveFile("_01"); } void draw() { }