Just thought I'd post a simple program I made using this - using the tablet as a simple synthesiser (very basic). I've still got using the tablet for something in the back of my mind.... I might even develop this program more with buttons etc for turning different effects on and off - or maybe using the existing buttons on the Wacom tablet.
Code:import ddf.minim.*;
import ddf.minim.signals.*;
import codeanticode.protablet.*;
Minim minim;
AudioOutput out;
SineWave sine;
SawWave saw;
Tablet tablet;
float proportion;
void setup()
{
size(1024, 768);
background(0);
tablet = new Tablet(this);
minim = new Minim(this);
// get a line out from Minim, default bufferSize is 1024, default sample rate is 44100, bit depth is 16
out = minim.getLineOut(Minim.STEREO);
// create a sine wave Oscillator, set to 440 Hz, at 0.5 amplitude, sample rate from line out
sine = new SineWave(440, 0.5, out.sampleRate());
saw = new SawWave(440, 0.5, out.sampleRate());
// set the portamento speed on the oscillator to 200 milliseconds
sine.portamento(200);
saw.portamento(200);
// add the oscillator to the line out
out.addSignal(sine);
out.addSignal(saw);
}
void draw()
{
fill(0, 10);
noStroke();
rect(0,0,width, height);
stroke(255);
if (mousePressed && mouseX > 0 && mouseX < width && mouseY>0 && mouseY<height)
{
strokeWeight(30 * tablet.getPressure());
line(pmouseX, pmouseY, mouseX, mouseY);
}
if ( out.hasControl(Controller.GAIN) )
{
float val = tablet.getPressure();
out.setGain(-80+val*128);
}
float freq = map(mouseY, 0, height, 1500, 60);
sine.setFreq(freq);
saw.setFreq(freq);
proportion=map(mouseX, 0, width, 0, 1);
sine.setAmp(proportion);
saw.setAmp(1-proportion);
}
void stop()
{
out.close();
minim.stop();
super.stop();
}