We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
I'm fairly new to Processing & I've been making this sketch (first time posting on forums, not sure how to copy in the code properly):
import processing.sound.*; SinOsc sine;
float time = 0; PImage img1;
void setup() { fullScreen(P2D); smooth(); img1 = loadImage("001.png"); sine = new SinOsc(this); sine.play(); }
void draw() { float x = 0; float freq=0.5; float amp=0.5; float pos;
while (x < displayWidth) { image(img1,x/2,heightnoise(x/140, time)); image(img1,displayWidth-x/2,heightnoise(x/140, time)); freq=map(x/2,heightnoise(x/140, time),displayWidth-x/2,heightnoise(x/140, time),0); sine.freq(freq); x = x + 0.2; }
time = time + 0.003; }
And when I try to run it the error "Could not run sketch (Target VM failed to initialise) make sure you haven't set maximum available memory too high... etc" appeared.
The error only started happening when I added the lines:
"freq=map(x/2,heightnoise(x/140, time),displayWidth-x/2,heightnoise(x/140, time),0);
sine.freq(freq);"
So it's definitely something to do with the sound element of the project, which is something I'm very new to.
Could someone lend me a hand?
Answers
Wow, that appeared as a huge jumbled mess... If someone could help me upload this code so it's legible that'd be cool too :')
or you could read the FAQ about formatting code... over there in Common Questions...
Here it is -- edit your original post with the gear icon and follow these simple instructions to format the code:
https://forum.processing.org/two/discussion/15473/readme-how-to-format-code-and-text