/ghibli-threejs:threejs-webaudio-generative-soundtrackfrom ghibli-threejs
Generates an original procedural soundtrack using Web Audio API for three.js/WebGL scenes. Creates a waltz with piano, string pad, and music box plus ambient river and birdsong, all synthesized without audio files.
Ships in ghibli-threejs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
An original piece (never a copy of a copyrighted theme) synthesised in the browser: a 16-bar waltz in a major key, piano melody over a bass-and-chord left hand, a soft string pad, and on the repeat an octave-up music box doubling the melody. Underneath, a looping river and occasional birdsong. Everything starts on the visitor's first gesture, fades in over 1.5 s, and toggles off with a fade. No audio assets required; an MP3 can replace the synth by setting one constant.
Stack: plain Web Audio (AudioContext, oscillators, BiquadFilter, ConvolverNode, DynamicsCompressor).
Framework-agnostic; it has no three.js dependency beyond living in the same page.
Add a
{{mood, e.g. Ghibli-style}}theme to{{entry file}}. Compose an original piece — never copy a copyrighted theme — and synthesise it live with Web Audio, starting on a user click:
- An original waltz: 3/4 at ~76 bpm, 16 bars in a major key,
[midi, beats]arrays.- Instruments: piano (triangle + sine partial, filter envelope); detuned-saw string pad through a low-pass; FM music box doubling the melody on the repeat.
- A generated convolution reverb and a compressor.
- Ambience: a looping brown-noise river through an LFO-breathing band-pass, plus random FM birdsong.
- A look-ahead scheduler (
setInterval120 ms, schedule 0.6 s ahead). Fade in and out. A music toggle.- If
{{SONG_URL}}is set, loop that file instead of the synth (same master gain, same toggle).
references/generative-waltz.js)voices → bus → compressor → master → destination, plus bus → convolver (wet .45) → compressor. Ambience goes
straight to master; birds go to the reverb so they sit in the space. master.gain starts at 0 and ramps to the
music volume over 1.5 s on start, to 0 over 0.8 s on stop, then ctx.suspend().
BPM = 76, BEAT = 60/BPM, bar = 3 beats. mtof(m) = 440·2^((m−69)/12).MEL[bar] = [[midi, beats], …] summing to 3 per bar; CH[bar] = [bass, n1, n2, n3].floor(step/16) % 2)
the music box doubles the melody an octave up. ~35 % of bars schedule a bird call.(1 − i/len)^2.6 — no impulse file needed.setInterval(schedule, 120); while (nextT < ctx.currentTime + .6) schedule one bar at nextT, then
nextT += 3·BEAT. Timing lives on the audio clock, so a janky render loop never makes the music stutter.
last = (last + .02·white)/1.02; d = last·3.2), looped, band-pass 700 Hz Q .5 whose
frequency an LFO (.09 Hz, ±260 Hz) breathes; gain .11.(1 − i/len)^1.6 tail through a 160–280 Hz
low-pass, gain ∝ storm intensity, started 1.2–3.4 s after the flash. Only once the visitor has let music start,
and never in ?silent capture runs.pointerdown / keydown /
touchstart anywhere (capture phase, one-shot listeners) starts it. A loading gate's "tap to enter" doubles as
that gesture (see threejs-cinematic-loading-screen). ?silent never arms it.new Audio(SONG_URL) with loop and preload:'none', so a multi-megabyte song doesn't race the
models down a phone's connection. Call music.buffer() (sets preload = 'auto' and load(), once) when the scene
is ready and the gate says "tap to enter"; the song is then buffered by the tap, and play() loads it anyway.
Route it with ctx.createMediaElementSource(song).connect(master) so the same fades and toggle apply.preload:'auto' on the song file starts a download (4.7 MB here) at page load, in competition with the scene's
own assets. Keep preload:'none' until the scene is ready.AudioContext before a gesture leaves it suspended; always ctx.resume() inside the gesture.exponentialRampToValueAtTime can't reach 0 — ramp to ~.0005–.0008, and stop oscillators after the release.o.stop(t + dur + 1.3)), or thousands of silent nodes pile up over a long session.threejs-cinematic-loading-screen · threejs-webgl-rain-effect (thunder) · threejs-camera-guided-tour (tour starts
music, ?tour&silent) · threejs-day-cycle-lighting
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub nicksonthc/ghibli-threejs --plugin ghibli-threejs31 skills in this plugin
/threejs-blender-glb-pipelineBuilds a reference-image-driven asset pipeline from headless Blender to GLB for a three.js scene — an asset contract (units, axes, grounding, required mesh/material names, budgets, attachment numbers), one parallel subagent per asset group writing craft_<slug>.py generators, preview renders compared against the reference, measured-bounding-box placement in the web scene, Draco compression, and a scored asset quality pass. Use when the user has a reference picture and wants a 3D scene from it, asks to model props/trees/characters in Blender for three.js, export GLBs, fix glTF export issues (vertex-colour alpha, UV flip, axes, custom normals), compress models, or rate and improve every asset in a scene./threejs-boat-buoyancy-steeringFloats a boat (or any buoyant prop) on three.js water with Gerstner waves generated from one JS table that feeds both the GLSL vertex shader and a CPU waveHeight(), four-probe heave/pitch/roll damped springs, an arc-length drift lane that bends round rocks, click-to-steer W/A/S/D rowing with momentum and drag, an autopilot that pursues the lane back, and a chase camera that keeps the orbit. Use when the user wants a drifting or steerable boat, buoyancy, objects bobbing on waves, Gerstner waves on a river/lake, a boat autopilot, or a follow/chase camera behind a vehicle on water.