Skip to content

M5.1: audio - #34

Merged
hynding merged 1 commit into
mainfrom
claude/m5.1-audio
Nov 21, 2026
Merged

hynding merged 1 commit into
mainfrom
claude/m5.1-audio

Conversation

@hynding

@hynding hynding commented Nov 21, 2026

Copy link
Copy Markdown
Owner

Requested by Steve · project thread

Stacked on #33 (M4.5). Merge that first.

What's new

  • Sound is pack content. Packs gain:

    • sounds: either a synth sound (wave, pitch sweep, duration) or an audio file (an audio asset or a site URL);
    • music: either a looping pattern of notes (tempo plus tracks like A2 . C3 - E3) or a looping file;
    • settings.audio, which names the sound for each event: hit, hurt (the player is hit), block, KO, pickup, and clearing a level;
    • sound (the swing) and hitSound on moves, and music on levels.

    These are optional additions, so older packs stay valid and no schema bump is needed. The registry checks every reference and that file sounds point at audio assets.

  • Default pack: synth sound effects (whoosh, punch, heavy hit, hurt, block, KO, pickup, clear) and a music pattern for each of the two levels. No audio files are needed, so the repository stays free of binary assets.

  • Engine (src/audio/engine.ts, WebAudio):

    • level music starts when a level starts, and is turned down while the game is paused or frozen;
    • audio starts on the first click or key press, as browsers require;
    • audio files are fetched and decoded once.
  • Volume: master, music and effects sliders. They're under SOUND on the start menu (in the controls box) and in the pause menu, and are saved per browser.

  • Forge:

    • a Sounds group and a Music group in the content tree;
    • ▶ Play to hear a sound, and Play/Stop for music;
    • Use an audio file… imports an MP3, Ogg or WAV into the pack and points the sound at it.
  • Bundles: audio files must be MP3, Ogg or WAV. This check came with M4.5: reports, moderation and upload checks #33.

Checks

  • lint, typecheck, 352 tests and the build all pass.
  • DEFAULT_CONFIG snapshot updated on purpose; the only changes are the audio additions.
  • New tests:
    • note parsing (pitch, rests, holds), step timing and volume parsing;
    • registry checks for unknown sounds and music, a file sound pointing at a non-audio asset, a bad note, and a file with both url and asset;
    • resolving file sounds to URLs;
    • importing an audio file and exporting it.
  • Headless play-through of level 1:
    • the level music starts and stops;
    • 40 attack presses gave 39 swing sounds, plus hit, hurt and KO sounds;
    • the music volume slider saves.
  • Forge, headless: sounds and music previewed.

Headless Chromium can't confirm that anything is audible. The run checks that the right sounds are requested at the right moments, using the engine's audioLog. Worth a listen when you review.


Generated by Claude Code

Sounds and music are pack content: synth sound effects and step-pattern
music (no files needed) or audio file assets. settings.audio names the
sound for hits, hurts, blocks, KOs, pickups and clearing a level; moves
can add a swing and hit sound, levels a music track. A small WebAudio
engine plays them, ducks the music while paused, and keeps master, music
and effects volumes per browser (start and pause menus). The Forge lists
sounds and music with a preview and can swap in an audio file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017AxU91KfohopVBJiiV9gwj
@hynding hynding self-assigned this Nov 21, 2026
@hynding hynding mentioned this pull request Nov 21, 2026
@hynding
hynding changed the base branch from claude/m4.5-moderation to main November 21, 2026 04:45
@hynding
hynding merged commit c7e2da4 into main Nov 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants