{"id":"music-box","version":"1.0.1","title":"Music Box","summary":"The bare movement of a music box: a pinned brass barrel plucks a steel comb, tooth by tooth, as the gears turn. Loops perfectly.","kind":"object","target":"three","collections":["satisfying","hypnotic-loops","chrome-glass"],"tags":["music box","mechanism","comb","barrel","gears","brass","lullaby","nostalgia","music","clockwork","loop","3d"],"loopable":true,"motion":"procedural","durationSeconds":12,"status":"published","media":{"poster":"https://aipixelwizard.com/media/music-box/1.0.1/poster.webp","preview":"https://aipixelwizard.com/media/music-box/1.0.1/preview.mp4","sample":"https://aipixelwizard.com/media/music-box/1.0.1/sample.mp4","sampleBytes":3319812,"sampleNote":"Pre-rendered with the default settings. Customised settings must be exported locally (npm run render)."},"urls":{"page":"https://aipixelwizard.com/visuals/music-box","manifest":"https://aipixelwizard.com/api/v1/visuals/music-box/versions/1.0.1","agentMd":"https://aipixelwizard.com/registry/music-box/1.0.1/agent.md","files":"https://aipixelwizard.com/registry/music-box/1.0.1/","demo":"https://aipixelwizard.com/registry/music-box/1.0.1/index.html"},"description":"The heart of a music box laid bare on a walnut base: a brass barrel studded with pins turns slowly, and each pin that comes round lifts the tip of one tooth of a steel comb and lets it go, so the tooth swings and settles (a little exaggerated so the eye can follow it). The pins spell out a tune, repeated every turn. At the end of the barrel a toothed gear spins a pinion and a small fan, and a winding key turns on its own post. Choose the tune (a lullaby, a waltz or rising chimes), the metal of the barrel, plates and gears, how many times the tune plays per loop, and how far the teeth swing.","role":"Hero object (Three.js 3D): a mechanical, nostalgic movement for music, memory and craft content.","useCases":["A nostalgic, tender or whimsical backdrop for music, memory and children's content","A craft and engineering moment: how a music box makes its tune","A visual to sync with a real music-box recording: the teeth move as the notes sound"],"synonyms":["music box mechanism","music box comb","pinned cylinder","clockwork music","mechanical music","lullaby box","tinkling music box","cylinder music box"],"digest":"a072c782a74143369d42543e423abe9cf3b6e40872b59223e26cd2ba3850b6f5","implementation":{"target":"three","runtime":"browser","language":"javascript","module":"esm","entry":"src/music-box.js","exports":[{"name":"createMusicBox","signature":"createMusicBox({ tune?, finish?, turns?, exaggerate?, seed?, anisotropy? }) => { group, teeth, axisY, notes, steps, update(time, loopSeconds), dispose() }","description":"The movement as a THREE.Group (1 unit = 10 cm, base on y = 0). update(time, loopSeconds) turns the barrel a whole number of times and swings each tooth when its pin comes round. notes lists every pin (step round the barrel, tooth) so a sound can be synced to it."},{"name":"TUNES","signature":"TUNES: { lullaby, waltz, chimes }","description":"The pin patterns: a number of steps round the barrel and the (step, tooth) of each pin."},{"name":"FINISHES","signature":"FINISHES: { brass, gold, copper, silver }","description":"Finishes for the barrel, plates and gears."}],"reusable":["src/music-box.js"],"demo":"demo.js","harness":"index.html"},"dependencies":[{"id":"three","version":"0.185.1","scope":"source","reason":"Renderer, geometry and physical metals."},{"id":"chrome-material","version":"1.1.0","scope":"demo","reason":"Studio environment light, backdrop, floor and contact shadow."},{"id":"apw-runtime","version":"1.0.0","scope":"demo","reason":"Demo harness."}],"uses":[],"usedBy":[],"params":[{"key":"tune","label":"Tune","type":"select","default":"lullaby","options":[{"value":"lullaby","label":"Lullaby"},{"value":"waltz","label":"Waltz"},{"value":"chimes","label":"Rising chimes"}]},{"key":"finish","label":"Metal","type":"select","default":"brass","options":[{"value":"brass","label":"Brass"},{"value":"gold","label":"Gold"},{"value":"copper","label":"Copper"},{"value":"silver","label":"Silver"}]},{"key":"turns","label":"Plays per loop","help":"Whole turns of the barrel in each loop.","type":"integer","min":1,"max":3,"step":1,"default":1},{"key":"swing","label":"How far the teeth swing","type":"number","min":0,"max":1.6,"step":0.1,"default":1},{"key":"background","label":"Room","type":"color","default":"#15110f"},{"key":"seed","label":"Seed","help":"Changes the wood grain.","type":"integer","min":1,"max":999,"step":1,"default":3}],"presets":[{"id":"default","label":"Lullaby, brass","params":{}},{"id":"waltz","label":"Waltz, gold","params":{"tune":"waltz","finish":"gold","turns":2,"background":"#120f14"}},{"id":"chimes","label":"Chimes, silver","params":{"tune":"chimes","finish":"silver","swing":1.3,"background":"#0f131a","seed":6}},{"id":"copper","label":"Lullaby, copper, slow","params":{"finish":"copper","swing":0.7,"background":"#1a1210","seed":11}}],"output":{"width":1080,"height":1080,"fps":30,"durationSeconds":12,"posterSeconds":4,"alpha":false,"motion":"procedural","loop":{"seamless":true,"cycleSeconds":12,"method":"The barrel makes a whole number of turns per loop and each tooth's swing, started by its pin, is measured from the pluck with wrap-around, so the tune and the teeth repeat exactly; the gears turn whole multiples of the barrel and the key turns a whole number of times."},"seed":{"param":"seed","behavior":"Seed changes the wood grain of the base."}},"composition":{"inputs":"Time within the loop; the tune, metal, plays per loop and the swing of the teeth.","outputs":"A THREE.Group: base, bedplate, barrel with pins, comb, gears, fan and key, standing on y = 0.","coordinates":"1 unit = 10 cm. The base is 9.2 × 7.4; the barrel (radius 1, length 5.4) lies along x at y = 2.1; the comb of 18 teeth lies in front of it towards +z.","lighting":"Physical metals: needs scene.environment; a shadow-casting key light draws the teeth's and pins' shadows on the plate.","timing":"update(time, loopSeconds) is a pure function of time; frames render in any order. The notes list gives the moment of every pluck for syncing sound.","compatibleWith":["chrome-material","orbit-camera","kinetic-title"],"notes":["A tooth's swing is exaggerated several times over so that it can be followed by eye; set swing to 0.3 for a subtle shimmer.","The gears' teeth are not phase-matched to each other; they turn in the correct ratios."]},"reuse":["Lullaby video: Lullaby, brass, with a soft title and a real recording of a music box.","Craft explainer: Waltz, gold, camera drift on.","Nostalgic scene: Lullaby, copper, slow, behind a photograph montage."],"integration":{"newProject":"Set scene.environment (createStudioEnvironment from Chrome Material works), add createMusicBox().group and a shadow-casting light, and call update(time, loopSeconds) each frame.","existingProject":"Copy src/music-box.js. Add the group to your scene, scale it, and call update(seconds, loopSeconds) every frame; use the notes array to sync sound."},"performance":{"notes":"About two hundred meshes built once and one instanced set of pins; only the barrel, the teeth, the gears and the key are reposed each frame. Smooth at 1080p on laptop GPUs.","limits":"Software WebGL (no GPU) renders slowly."},"limitations":["The teeth swing as rigid levers rather than bending, and their frequencies are scaled for the eye, not for the ear.","No sound is produced: the tune is only in the pins."],"license":{"spdx":"MIT","notice":"Copyright (c) 2026 AI Pixel Wizard. Released under the MIT License. See LICENSE in this folder.","thirdParty":[{"name":"three.js","version":"0.185.1","license":"MIT","url":"https://github.com/mrdoob/three.js"}]},"rights":{"approvedForPublicRelease":true},"provenance":"Adapted from the owner's threejs-sketches/objects-scenes/music-box-dancer (MIT), rebuilt for AI Pixel Wizard in October 2026 as the bare movement of a music box: a pinned barrel, a stepped steel comb whose teeth are plucked in time with the pins, a gear train with a fan, a winding key, a walnut base, studio light and shadows, an exact loop and the frame/time contract.","changelog":[{"version":"1.0.1","date":"2026-10-08","notes":"Instanced meshes are no longer culled using their first-frame bounds, so nothing can vanish when parts move far from where the first frame left them. No visual change."},{"version":"1.0.0","date":"2026-10-05","notes":"Initial release."}],"verification":{"testedOn":"2026-10-08","inputs":{"music-box@1.0.1":"a072c782a74143369d42543e423abe9cf3b6e40872b59223e26cd2ba3850b6f5","three@0.185.1":"664ca387e5fab46ff2daaa6895e1d015426850891af5ea5082cbbcc3985b068c","chrome-material@1.1.0":"ecb41776bfc1ee88997604f916a5ffe833f971d7edcc97c855697a5792d6f1dd","apw-runtime@1.0.0":"5be859cdac74823ba0bcc32c6daf06688a871104d24db5d4ceaffffd84d7c40d"},"environment":"Chrome 154.0.8037.97 headless on Linux 7.0.0-38-generic (x64), Node 22.14.0","renderer":"WebGL 2 via SwiftShader (software)","width":1080,"height":1080,"fps":30,"frames":360,"renderSeconds":921.2,"loopCheck":{"checked":true,"seamless":true,"maxDifference":0,"note":"Frame 0 vs end state (progress 1): mean |Δ| 0.0000, max |Δ| 0 of 255."},"determinism":{"checked":true,"identical":true},"errors":[],"media":{"poster":"/media/music-box/1.0.1/poster.webp","preview":"/media/music-box/1.0.1/preview.mp4","sample":"/media/music-box/1.0.1/sample.mp4","sampleBytes":3319812}},"files":[{"path":"LICENSE","size":1072,"sha256":"8a5f3a96f07e11522ec4bdd0a583356f99bad1245920f9709cee09b995a45153","contentType":"text/plain; charset=utf-8","url":"https://aipixelwizard.com/registry/music-box/1.0.1/LICENSE"},{"path":"asset.json","size":9599,"sha256":"4d9d958f325a6770afa7482f21bec720eaecb9f92440dc46c24b006b1b41d3d5","contentType":"application/json; charset=utf-8","url":"https://aipixelwizard.com/registry/music-box/1.0.1/asset.json"},{"path":"demo.js","size":3224,"sha256":"c4e95fd63258c65ea7a4028a14cd96e563a8809274ccf5274bb8d156d6b7b788","contentType":"text/javascript; charset=utf-8","url":"https://aipixelwizard.com/registry/music-box/1.0.1/demo.js"},{"path":"index.html","size":523,"sha256":"a457c8b733b852bd9a623ae1af3c44b2c845ac0a737888b2013866bc3579e73c","contentType":"text/html; charset=utf-8","url":"https://aipixelwizard.com/registry/music-box/1.0.1/index.html"},{"path":"src/music-box.js","size":19209,"sha256":"78a2a7569e63c770ef5baf5a46bd23bc6dc025dba8e478c3e58efeeef5737632","contentType":"text/javascript; charset=utf-8","url":"https://aipixelwizard.com/registry/music-box/1.0.1/src/music-box.js"}],"warnings":[]}