engines/kick.js — SynthKick
The kick drum synthesiser. Defined as a SynthEngine object with 15 modules.
Uses the unified buildLiveChain + trigger pattern (no legacy render).
Modules
1. Pitch (source)
| Param | Range | Default | Description |
|---|---|---|---|
pitchStart |
80–400 Hz | 220 | Initial oscillator frequency |
pitchEnd |
25–100 Hz | 50 | Final frequency after decay |
pitchDecay |
0.03–0.5 s | 0.06055 | Sweep duration |
sineLevel |
0–1 | 1 | Sine oscillator level |
triangleLevel |
0–1 | 0 | Triangle oscillator level |
sawtoothLevel |
0–1 | 0 | Sawtooth oscillator level |
pitchCurve |
exponential/linear | exponential | Contour of the frequency sweep |
subMix |
0–1 | 0.5 | Sub oscillator (sine, octave down) blend |
subDecay |
0.05–1.5 s | 0.5 | Sub oscillator tail length |
bodyMode |
mix/fm | mix | Oscillator architecture: parallel mix or FM synthesis |
fmAmount |
0–1 | 0 | FM modulation depth (bodyMode=fm) |
fmRatio |
0.25–4 | 1 | Carrier:modulator frequency ratio |
fmCarrier |
sine/triangle/saw | sine | Carrier waveform for FM mode |
fmSource |
sine/triangle/saw/sub | triangle | Modulator waveform for FM mode |
fmFeedback |
0–0.5 | 0 | Self-FM feedback amount |
In mix mode, creates a parallel oscillator bank with sine/triangle/saw waves summing together. Each oscillator gets the pitch envelope and a gain envelope that starts at level, drops to 70% over the pitch decay, then fades to silence. Sub oscillator plays a sine at half frequency with independent decay tail.
In fm mode, one oscillator frequency-modulates another (carrier driven by
modulator). The modulator's frequency is set by fmRatio × carrier frequency.
The pitch envelope can optionally apply to both carrier and modulator.
Self-FM feedback creates additional harmonic complexity.
2. Transient (source)
| Param | Range | Default | Description |
|---|---|---|---|
noiseAmount |
0–0.5 | 0.12 | White noise burst volume |
noiseDecay |
0.003–0.08 s | 0.015 | Noise fade time |
clickMode |
sine/noise/impulse/metallic | sine | Click algorithm |
clickMix |
0–0.3 | 0.1 | Overall click blend level |
Sine mode:
| Param | Range | Default | Description |
|---|---|---|---|
| clickTone | 200–2000 Hz | 800 | Pitched click frequency |
| clickSlam | 0–1 | 0 | Frequency drop amount (0=none, 1=max) |
| clickDecay | 0.003–0.08 s | 0.015 | Click duration |
Noise mode: Filtered noise burst with adjustable tone.
| Param | Range | Default | Description |
|---|---|---|---|
| clickNoiseColor | white/pink/brown | white | Noise colour |
| clickNoiseBPFreq | 500–8000 Hz | 3000 | Bandpass centre |
| clickNoiseBQ | 0.5–10 | 2 | Bandpass Q |
| clickNoiseDecay | 0.002–0.05 s | 0.008 | Noise fade time |
Impulse mode: Very short shaped pulse.
| Param | Range | Default | Description |
|---|---|---|---|
| clickImpulseLen | 0.0005–0.005 s | 0.002 | Pulse length |
| clickImpulseShape | square/triangle/gaussian | square | Pulse shape |
Metallic mode: Multiple sine oscillators at harmonic ratios.
| Param | Range | Default | Description |
|---|---|---|---|
| clickMetalFreq | 500–4000 Hz | 1500 | Fundamental ring frequency |
| clickMetalHarmonics | 1–8 | 4 | Number of harmonics |
| clickMetalDecay | 0.01–0.2 s | 0.04 | Ring decay |
| clickMetalSpread | 0–1 | 0.3 | Detune spread between harmonics |
3. Transient Shaper (source)
| Param | Range | Default | Description |
|---|---|---|---|
tsEnable |
off/on | off | Split body and transient sources |
tsAttackGain |
-12 – +12 dB | 0 | Transient layer gain (noise + click) |
tsSustainGain |
-12 – +12 dB | 0 | Body layer gain (oscillators + sub) |
tsAttackEQ |
-6 – +6 | 0 | High-shelf EQ on the transient layer |
When enabled, routes body sources (oscillators, sub) and transient sources (noise, click) through separate gain paths with independent level and EQ control before summing into the main processor chain.
4. Distortion
Dynamic stage pipeline with 9 drive types (off, softClip, hardClip, tape,
exponential, tanh, bitcrush, wavefold, full-wave rectify). Each stage has
type, amount, and drive controls. Stages can be locked to prevent
randomisation.
5. Body Resonance (processor)
| Param | Range | Default | Description |
|---|---|---|---|
bodyResEnable |
off/on | off | Enable the resonant drum body model |
bodyResFreq |
40–200 Hz | 80 | Centre frequency of the body resonance |
bodyResQ |
1–40 | 10 | Resonance amount |
bodyResDecay |
0.02–1.0 s | 0.2 | How long the body resonance rings |
bodyResMix |
0–1 | 0.5 | Dry/wet blend |
bodyResTrack |
0–1 | 0 | How much the resonance follows the pitch envelope |
Physical modelling filter using a bandpass BiquadFilter with a decaying gain envelope. Models the resonant shell of a drum body for more acoustic/realistic kick sounds.
6. Filter (processor)
| Param | Range | Default | Description |
|---|---|---|---|
filterCut |
200–20000 Hz | 20000 | Low-pass cutoff (bypassed at 20000) |
BiquadFilter node with type: 'lowpass'. When cutoff is at maximum (20000 Hz),
the filter bypasses (returns input unchanged).
7. EQ (processor)
| Param | Range | Default | Description |
|---|---|---|---|
eqLow |
-12 – +12 | 0 | Low-shelf gain at 250 Hz |
eqMid |
-12 – +12 | 0 | Peaking gain at 1 kHz, Q 0.7 |
eqHigh |
-12 – +12 | 0 | High-shelf gain at 8 kHz |
3-band shelving/peaking EQ. Manual adjustment only (not randomised by default).
8. Compressor (processor)
| Param | Range | Default | Description |
|---|---|---|---|
compThreshold |
-60 – 0 dB | 0 | Compressor threshold (0 = no compression) |
compRatio |
1–20 | 1 | Compression ratio (1 = no compression) |
compAttack |
0.001–0.1 s | 0.001 | Attack time |
compRelease |
0.01–1.0 s | 0.01 | Release time |
compKnee |
0–40 dB | 0 | Soft knee width |
compMakeup |
0–24 dB | 0 | Output gain boost |
compMix |
0–1 | 1 | Dry/wet blend |
compSC |
off/on | off | Sidechain high-pass filter |
compSCFreq |
20–1000 Hz | 200 | SC HPF cutoff |
Default is pass-through (threshold 0, ratio 1). Manual adjustment only (not
randomised). Uses the shared modules/compressor.js with full dry/wet mix,
sidechain HPF, and makeup gain.
9. Clarity (processor)
Multiband dynamic processor with mud (200–800 Hz), mid (500–3000 Hz), and air (2000–8000 Hz) bands. Each band has independent threshold, ratio, attack, release, makeup, listen/solo, phase invert, and bypass controls. Sidechain HPF shared across bands. Wet-only mode available.
10. Volume (master)
| Param | Range | Default | Description |
|---|---|---|---|
volAttack |
0.001–0.1 s | 0.002 | Time from silence to peak |
volDecay |
0.05–0.8 s | 0.3 | Time from peak to silence |
Simple AD envelope (no sustain/release — kicks are one-shot). Schedules
linearRampToValueAtTime on the master gain node. Total duration:
max(0.5, attack + decay + 0.1).
11. Velocity Response (master params)
| Param | Range | Default | Description |
|---|---|---|---|
veloSensitivity |
0–1 | 1 | Master velocity influence on overall level |
veloClick |
0–1 | 0 | Velocity → click mix amount |
veloNoise |
0–1 | 0 | Velocity → noise amount |
veloBody |
0–1 | 0.3 | Velocity → body brightness |
veloPunch |
0–1 | 0 | Velocity → attack compression |
Modulates source levels based on MIDI/sequencer velocity. Higher values mean
the corresponding parameter is more affected by velocity. veloSensitivity
controls the overall curve shape (1 = full velocity tracking, 0 = constant).
12. Normalize (builtin)
| Param | Default | Description |
|---|---|---|
normalize |
true | Peak or RMS normalise WAV export |
normTarget |
-1 dBFS | Target level |
normMode |
peak/rms | Normalisation algorithm |
normCeiling |
false | Hard-clip above target |
normDC |
false | Remove DC offset |
Signal Chain
body sources (osc + sub) ——┐
├──→ [distortion stages]
transient sources (noise │ ↓
+ click) ─────────────────┘ → body resonance (bandpass)
↓ ↓
(optional split) → filter (lowpass)
attack gain / EQ ↓
sustain gain → 3-band EQ
↓
→ compressor (pass-through default)
↓
→ clarity (multiband mud/mid/air)
↓
→ master gain (AD volume)
↓
→ destination
After rendering, normalize is applied to the PCM samples if enabled.
Genre-Targeted Randomisation
Nine curated randomisation profiles in the controls row:
| Genre | Character |
|---|---|
| Any | Existing per-module randomisation (full range) |
| DnB | Fast pitch decay, sub-heavy, aggressive click, harder compression |
| Techno | Longer decay, more distortion, prominent click, less sub |
| House | Moderate pitch, clean sine, punchy click, balanced |
| 808 | Very low pitch, long decay, sub-heavy, minimal click |
| Neuro | Saw-heavy, fast decay, aggressive distortion, high click slam |
| Experimental | Wild ranges, FM body, heavy distortion |
| Lo-Fi | Warm, soft attack, darker filter, subtle click |
| 909 | Punchy sine-dominant, tight decay, prominent click, TR-909 style |
| 707 | Synthetic/metallic, triangle/saw blend, more noise, TR-707 style |
Each genre covers pitch, sub, transient, volume envelope, and filter cutoff with genre-appropriate ranges. Remaining params (FM, body resonance, click mode details, EQ, velocity, clarity, etc.) are filled by per-module randomisation.
Factory Presets
Six built-in presets in static/js/synth/presets/kick/:
| Preset | Description |
|---|---|
| Default | Clean sine kick, linear pitch curve, no distortion, pass-through compressor |
| Hard Neuro | Saw-heavy aggressive kick, exponential pitch, high click slam, body resonance at 100 Hz / Q 18 for punchy ring |
| Deep DnB | Deep sub-heavy kick, exponential pitch, moderate click with slam, body resonance at 85 Hz / Q 12 |
| Sub Focus | Extreme sub focus, low pitch start (150 Hz), long sub tail (1.2 s), body resonance at 55 Hz / Q 5 for deep body |
| Rolling | Balanced driving kick, exponential pitch, moderate click + slam, body resonance at 90 Hz / Q 14 |
| Jump-Up | Bright aggressive kick, high pitch start (350 Hz), heavy click slam (0.8), body resonance at 130 Hz / Q 15 for snap |
| Liquid | Smooth clean kick, linear pitch, subtle click, body resonance at 70 Hz / Q 8 for warmth |
All presets have distortion locked and stages set to empty — distortion must be explicitly enabled. Each preset features tuned body resonance settings.
Canvas Visualisations
Three envelope canvases rendered in a dedicated Envelopes card:
| Canvas ID | Module | Curve |
|---|---|---|
env-pitch |
Pitch | Exponential decay of frequency from start to end |
env-volume |
Volume | AD amplitude envelope (attack → decay to 0) |
env-transient |
Transient | Exponential decay of transient amplitude |
An additional spectrogram canvas (toggleable via ▸ Spec button) shows a scrolling waterfall FFT display of the live output, visualising frequency evolution over time.
Extracted Functions
The trigger() function delegates to standalone exported functions for
testability and reuse:
| Function | Purpose |
|---|---|
computeSourceLevels(params) |
Pure — normalises source levels across all layers |
computeVelocityFactors(velocity, params) |
Pure — computes velocity response scales |
createNoteGain(ctx, params, velocity, time) |
Per-note AD gain envelope |
createOscillatorBank(ctx, waveDefs, params, time, dur, noteGain) |
Parallel oscillator bank (mix mode) |
renderFMBody(ctx, params, time, dur, srcNorm, noteGain) |
FM synthesis body (fm mode) |
createSub(ctx, params, time, dur, srcNorm, noteGain) |
Sub oscillator at half frequency |
createNoiseBurst(ctx, params, time, srcNorm, noteGain) |
White noise transient |
createClick(ctx, params, time, srcNorm, noteGain) |
Click dispatcher (routes to mode) |
renderClickSine / renderClickNoise / renderClickImpulse / renderClickMetallic |
Per-mode click renderers |
Files
| File | Purpose |
|---|---|
engines/kick.js |
Engine definition + extracted source functions |
modules/body-resonance.js |
Body resonance physical model module |
modules/transient-shaper.js |
Transient/sustain split module |
modules/spectrogram.js |
Spectrogram waterfall visualisation |
kick-genre-ranges.js |
Genre-targeted randomisation data + function |
init-kick.js |
Bootstrap with keyboard, piano, spectrum/spectrogram analysers, norm meter, live audio |
templates/synth_kick.html |
Standalone page with preset sidebar, piano keyboard, spectrum/spectrogram canvases, envelope visualisers, genre selector |
presets/kick/ |
Built-in presets (default, hard-neuro, deep-dnb, sub-focus, rolling, jump-up, liquid) |
The standalone page supports piano mouse/touch and computer keyboard playback,
live audio preview with spectrum analyser and toggleable spectrogram, and
keyed 24-bit WAV export. Pressing different keys changes the kick's
fundamental pitch via noteFreq.