class SoundModule { Minim m; AudioOutput dac; SineWave sine; SoundModule(PApplet a) { m = new Minim(a); dac = m.getLineOut(Minim.STEREO); sine = new SineWave(0, 0.5, dac.sampleRate()); //it is all in the minim documentation which is quite good, but portamento means that there //will be no pause when changing from one frequency to another, instead there is a 200 ms slide from //the original tone to the new one. sine.portamento(200); dac.addSignal(sine); } void freq(float f) { //if a frequency is present, map it to a sine with Hz between 440 and 880 (and octave) if(f > 0) { f = map(f, 0.1, height, 440, 880); } else{ f = 0; } sine.setFreq(f); } //again remenber to close the connection to the soundcard void stop() { m.stop(); dac.close(); } }