Eight small instruments, each ready to play and change. Every example is a complete program. Replace the whole previous example when comparing them. The settings are starting points: the interesting part is discovering which changes make a sound feel like yours.
If patch, pitch, or ampEnv is unfamiliar, visit Build a synth sound first. Use Ready-made instruments when you want a larger collection to explore.
1. A rounded sub bass#
Listen for: a deep, clean fundamental with a little body from a second oscillator. The short attack and release keep the notes defined.
tempo = 120bpm
timingVersion = 2
subbass = patch {
source = sine (freq pitch) + triangle (freq pitch * 2) * 0.15,
ampEnv = adsr 8ms 150ms 0.6 90ms,
gain = vel * 0.35
}
play subbass "c2 ~ [c2 g2] bb1"
Make it yours: raise 0.15 to 0.35 if the bass needs more upper detail. An extra octave component helps its shape survive on smaller speakers without simply increasing the deepest frequencies.
2. A resonant saw bass#
Listen for: a bright bite at the start of each note, followed by a darker body. The filter envelope creates the pluck.
tempo = 124bpm
timingVersion = 2
pulsebass = patch {
source = saw (freq pitch),
filtEnv = adsr 2ms 180ms 0 80ms,
cutoff = 250Hz + filtEnv * 2400Hz,
resonance = 4,
ampEnv = adsr 4ms 160ms 0.3 90ms,
gain = vel * 0.22
}
play pulsebass "c3 [c3 eb3] g3 [bb2 c3]"
Make it yours: increase the filter decay from 180ms to 350ms. For other resonant colors, continue to Filters.
3. Glassy FM keys#
Listen for: a chiming attack that settles into a simpler tone. One sine oscillator changes the frequency of another; the envelope reduces that change as the note decays.
tempo = 110bpm
timingVersion = 2
glasskeys = patch {
filtEnv = adsr 2ms 500ms 0.05 200ms,
source = sine (freq pitch + fm (sine (freq pitch * 2)) (filtEnv * 700Hz)),
ampEnv = adsr 3ms 500ms 0.15 350ms,
gain = vel * 0.3
}
play glasskeys "c4 [eb4 g4] bb4 g4" |> reverb 0.41 0.2
Make it yours: change the modulator ratio * 2 to * 2.7 for a more metallic color. See FM, phase and ring modulation.
4. A moving wavetable pad#
Listen for: the tone changing within a held note, as the oscillator moves through the supplied harmonics table. The melody itself stays simple.
tempo = 120bpm
timingVersion = 2
tablepad = patch {
source = wavetable "harmonics" (freq pitch)
(lfoSine 0.2Hz |> scale [0.1, 0.8]),
ampEnv = adsr 450ms 400ms 0.7 700ms,
gain = 0.25
}
play tablepad ("c4 g4" |> slow 4) |> reverb 0.53 0.25
Make it yours: try the formant table for a more vowel-like motion. This changes the wavetable; the scan rate stays the same. See Wavetables.
5. A plucked string#
Listen for: a sharp excitation becoming the ringing body of a string. The source is a physical model, so you can change the damping and the place where the virtual string is picked.
tempo = 112bpm
timingVersion = 2
harpvoice = patch {
source = string (freq pitch) 0.22 0.7 0.18,
gain = vel * 0.4
}
play harpvoice "c4 [g4 bb4] eb5 g4" |> reverb 0.41 0.2
Make it yours: change the pick position from 0.18 to 0.45. Different positions emphasize different parts of the string's tone. Explore Physical modeling for bowed strings and resonators.
6. An imaginary bell#
Listen for: several ringing frequencies decaying at different rates. The non-integer ratios give this bell a metallic identity.
tempo = 120bpm
timingVersion = 2
smallbell = patch {
source = modal (freq pitch)
[[1, 1.5s, 1], [2.76, 1s, 0.45], [5.4, 600ms, 0.2]],
gain = vel * 0.4
}
play smallbell "c4 ~ g4 ~" |> reverb 0.47 0.2
Make it yours: replace 2.76 with 3 and 5.4 with 5 for more harmonic ratios. Each list row is [frequency ratio, decay time, strength]. You are designing the object's resonances rather than selecting a recorded bell.
7. An additive organ#
Listen for: a steady, hollow tone made by adding selected sine-wave partials. There is no filter removing the missing harmonics; they are absent from the recipe.
tempo = 120bpm
timingVersion = 2
drawbars = patch {
source = additive (freq pitch) [1, 0, 0.5, 0, 0.25],
ampEnv = adsr 8ms 0ms 0.8 100ms,
gain = vel * 0.25
}
play drawbars "c4 eb4 g4 bb4"
Make it yours: put 0.4 in the second slot. That adds the second harmonic, one octave above the fundamental. Additive synthesis lets those partials move independently, too.
8. A drum machine made from synthesis#
Listen for: a low resonant kick, a noisy snare, and metallic hats. These sources synthesize the hits, so this program needs no drum recordings.
tempo = 118bpm
timingVersion = 2
kickvoice = patch { source = kick808 0.45 0.4 0.25, gain = vel * 0.6 }
snarevoice = patch { source = snare808 0.45 0.55, gain = vel * 0.35 }
hatvoice = patch { source = hat606 0.12 0.55, gain = vel * 0.25 }
play kickvoice "c3*4"
play snarevoice "~ c3 ~ c3"
play hatvoice "c5*8" |> gain "[0.7 0.3]*4"
Make it yours: change the kick's decay from 0.4 to 0.7. Then listen to whether the longer tail leaves room for the next hit. The classic drum sources use their own tuning knobs; the note pattern triggers them. Drum synthesis covers the full kit.
Take a recipe further#
Choose one patch, give it a new pattern, then add only one effect. A single good instrument can support a whole track when its rhythm, register and brightness change over time. Modulation adds movement; From loop to finished track gives it a form.