I've written some code that I want to run when some input, like a key on the keyboard, is pressed. I'm not sure how to implement this.
Ideally, I'd like to run this simultaneously with processing so that both programs start doing their thing at the same time. So I press a button, and my audio (arduino) and visual (processing) begin running at the same time.
I have not programmed in Processing for a while but I remember there is a keyboard class that can capture keyboard input. If you use that and send to arduino a command via serial port, you can control arduino.