Target VM failed to initialise - make sure you haven't set maximum available memory too high

edited August 2017 in Library Questions

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?

Tagged:

Answers

Sign In or Register to comment.