Learn creative coding writing simple programs

101. Control Processing using a MIDI controller

This time we learn no new programming concepts, but find out how to install a MIDI library in Processing to be able to control program parameters using an external hardware device. MIDI controllers are often used together with music programs to do things like changing volumes or effect amount. But they are a great tool for experimenting with your programs, because they allow you to change numbers without having to restart your program. You just turn a knob or move a slider and see the graphics change.
Unfortunately in this episode you won't see anything moving since the library does not work with my setup. But don't worry, in the next episode we will try another approach which works fine.
The basic usage of the promidi library is quite simple. You import the library, declare a variable that will hold your MIDI connection and use getInstance() to start the MIDI connection. Next you add one or more calls to plug(). This will tell Processing that certain functions must be executed every time a MIDI message arrives. Then you have to decide what do you want to do with the numbers you receive: you can move or create objecs, change colors or other properties, etc.

Tags: midi, promidi, controller

Code editor

You can make changes to the code below. Then
Reference

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:
``` void setup() { size(600, 600); } ```