Build custom synthesizers for midigarden using Pure Data
midigarden wraps your patch with automatic voice allocation. You build a single-voice synth, and the app creates multiple instances to handle polyphony and mixing.
Your patch receives: MIDI note (pitch) and velocity as a packed message at the inlet
Your patch outputs: Audio signals from two outlets (left and right)
The amber patch is a good starting point. It uses four sine oscillators at harmonic ratios (1x, 2.03x, 3.04x, 5.02x) with amplitude envelope and soft clipping. Smooth organ/flute/bell tones that saturate cleanly when driven.
Start with an inlet connected to unpack f f. This separates the packed pitch and velocity values.
Use mtof to convert MIDI note number to frequency in Hz. Connect this to your oscillators.
Velocity ranges 0-127. Use it to control amplitude, filter cutoff, or modulation depth. sel 0 can detect note-off messages (velocity = 0).
Build your synthesis: oscillators (osc~, phasor~), noise (noise~), filters (lop~, bp~), etc.
Use line~ or vline~ to create attack/decay envelopes. Multiply your signal by the envelope.
End with two outlet~ objects for left and right audio channels. Connect your final signal to both.
Before transferring to midigarden, test your patch in Pure Data on your computer.
Important: To hear audio in Pure Data, you need a dac~ object. Connect the signals that go into your two outlet~ objects into a dac~ instead. The dac~ has left and right inputs for stereo output.
The amber.pd starter includes test buttons (the bangs at the top) that send note messages so you can hear the sound without external MIDI.
Use horizontal sliders (hsl) or number boxes (nbx) to add tweakable parameters. These will appear in midigarden's edit mode.
For receive symbols, use the $2- prefix (e.g., $2-decay). This becomes the patch name when instantiated, allowing unique parameter addressing per voice.
.pd file.pd file into the midigarden folderclip~ -1 1 or tanh to prevent harsh distortion.