I'm currently building an interface that allows a user to draw a waveform into a box in realtime which will be used MAX/Msp over Osc to generate sound. I've got the waveform drawing bit working more or less how I want, but I'd like to make it look much prettier than it does (which is the whole point of using Processing rather than just the standard Max interface!). At the moment the waveform edge is covered with jaggies, and I want it to be antialiased so it looks smoother. I'm no graphics programmer and I'm slightly at a loss as to how to achieve this.
At the moment I'm drawing the curve using a quad for each position of the waveform which gives some antialiasing from the smooth() function, but, since there are so many data points it's still very jaggy; I'm sure there must be a better way to do it (line 22 2nd tab). I need to store the data for the waveform in the array in this way as this is the format I need for the audio, but it could be displayed in any way. The important thing is that the waveform display changes in realtime.
Any suggestions are welcome - I'm new to Processing so I may well be missing something really obvious!
Code posted below - I've removed a lot of extraneous stuff to keep it clear.
//Opens a wave drawing window that interfaces with a MAX buffer over OSC
WaveBox waves = new WaveBox;
void setup ()
size(480, 240, P2D);
drawWidth = 440;
drawHeight = 200;
waves = new WaveBox(20,20,drawWidth, drawHeight);
I'm writing a sketch (my first - so apologies if this is a stupid question!) to control a synthesiser in Max/MSP using OSC to transfer data.
I'm trying to find a way to run some code if my sketch is closed so I can shut off any notes that the synth is currently playing. At the moment if the sketch closes mid note, the note continues on forever in Max. Obviously I can control this manually from Max, but I'd much rather control it automatically from Processing.
Is there any onExit() event or something that I could use for this? I can't seem to find one.