Hi, I'm receiving this error in the line 69 that reads "float yoffset = (height - b) ) / height;", but I'm not sure why. Can someone help?
//import libraries
PImage img;
import ddf.minim.*;
import ddf.minim.ugens.*;
Minim minim;
AudioOutput out;
Oscil wave;
//display image
void setup() {
size(800, 800);
img = loadImage("MarsMapSection.jpg");
//noise = new WhiteNoise(this);
//noise.play();
minim = new Minim(this);
// use the getLineOut method of the Minim object to get an AudioOutput object
out = minim.getLineOut();
// create a sine wave Oscil, set to 440 Hz, at 0.5 amplitude
wave = new Oscil( 440, 0.5f, Waves.SINE );
// patch the Oscil to the output
wave.patch( out );
}
void draw() {
loadPixels();
// Since we are going to access the image's pixels too
img.loadPixels();
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int loc = x + y*width;
// The functions red(), green(), and blue() pull out the 3 color components from a pixel.
float r = red(img.pixels[loc]);
float g = green(img.pixels[loc]);
float b = blue(img.pixels[loc]);
// Image Processing would go here
// If we were to change the RGB values, we would do it here,
// before setting the pixel in the display window.
// Set the display pixel to the image pixel
pixels[loc] = color(r,g,b);
}
}
float r = red(img.pixels[mouseY*width+mouseX]);
float b =blue(img.pixels[mouseY*width+mouseX]);
float g =green(img.pixels[mouseY*width+mouseX]);
println("r" + r);
println("b" + b);
println("g" + g);
}
void mouseMoved(){
// usually when setting the amplitude and frequency of an Oscil
// you will want to patch something to the amplitude and frequency inputs
// but this is a quick and easy way to turn the screen into
// an x-y control for them.
float yoffset = (height - b ) / height;
float freq = pow( 3, r ) + yoffset;
wave.setFrequency( freq );
float amp = map( mouseX, 0, width, 1, 0 );
wave.setAmplitude( amp );
// float freq = map( mouseX, 0, width, 110, 880 );
// float yoffset = (height - mouseY) / float(height);
// float freq = pow(1000, yoffset) + 150;
// float amp = map( mouseX, 0, width, 1, 0 );
// wave.setAmplitude( amp );
// float freq = map( mouseX, 0, width, 110, 880 );
// wave.setFrequency( freq );
}