import krister.Ess.*; // Sound AudioChannel myChannel; void setup(){ size(400,200); PFont font = loadFont("Courier-12.vlw"); textFont(font); textAlign(CENTER); frameRate(2); Ess.start(this); // for loading sound } void draw(){ background(0); fill(255, 255, 255); text("Total Memory: " + java.lang.Runtime.getRuntime().totalMemory()/1000. + " kB", width/2, height/2 - 20); text("Free Memory: " + java.lang.Runtime.getRuntime().freeMemory()/1000. + " kB", width/2, height/2 + 20 ); } void mousePressed(){ try{ myChannel = new AudioChannel("drumloop.wav", 1); // loading sound using ESS Library // You need to destory it when you want to assign a new instance text("Sound Loaded.", width/2, height/2 + 60); } catch(OutOfMemoryError e){ println("Out of Memory: " + e.getMessage()); fill(255, 0, 0); text("Out of Memory!!", width/2, height/2 - 60); } catch (Exception e){ println("Exception: " + e.getMessage()); } }