Sketches
A Sketch note runs a p5.js sketch. Drop a .js file on a pad. Padjam draws the sketch's canvas into the picture like a clip, so transparent black, priority, Feedback and recording all work with it.
Sketches run in a sandbox: they can't reach Padjam's page, your stored performances or your files.
What a sketch can read
padjam.note, padjam.velocity |
The note playing it, and its velocity (0-127) |
padjam.held, padjam.time |
Whether it's held, and milliseconds since the note started |
padjam.cc[n] |
Controller values (0-127), for the controller set in its options |
padjam.audio |
level, bass, mid, treble (0-1) and beat, from audio input |
padjam.buffer |
The picture so far, as a p5.Graphics, with Reads the frame buffer on |
A sketch can also define noteOn(note, velocity), noteOff(note) and controlChange(controller, value).
The sketch's window is the output's size, so createCanvas(windowWidth, windowHeight) fills the screen.
Good to know
clear()leaves the sketch see-through, and like every see-through layer it builds up trails, because Padjam's picture is never wiped. Usebackground()for a clean frame.- Reset playback runs
setup()again on each note. - A sketch that reads the frame buffer is an effect: give it a higher priority than the notes under it.
- Padjam bundles p5 2, so it works offline. Sketches written for p5 1 mostly run;
preload()becomesasync setup(). - Errors show in the header.
Examples
Padjam comes with example sketches: particles, bars, a starfield, an oscilloscope, words, tunnels, flow fields, and effects that mirror, glitch, pixelate or zoom what's underneath. They're in the examples/sketches folder.