composer.html, SFX.html & studio.js)SFX.html via fetch(), parses #sfxComposerPanel with DOMParser, mounts it into #sfxEmbedContainer via document.importNode(), and appends <script src="studio.js"> afterward so both the Song Composer and SFX Designer initialize together without duplicating HTML markup. Falls back to a direct link if opened over file://.setStudioMsg(msg): Updates #studioStatus in the top bar with playback, clipboard copy, or file download feedback.
downloadUpdatedSoundsJs(extraTrack, extraSfx): Clones LEVELS and SFX_DATA (stripping temporary __preview__ keys), merges in any newly created track or SFX entry without duplicating matching names, serializes N, LEVELS, and SFX_DATA into a UTF-8 Blob, and triggers a browser download of sounds.js.
#songComposerPanel in studio.js) studio.jspreviewSingleNote(noteKey: string): void: Unlocks audio via soundtrack.unlockSync() and plays a 0.25s preview tone at N[noteKey] using the active voice's waveform (#songWave or #songBassWave).
appendNoteToTextarea(noteKey: string): void: Appends a NOTE:BEATS token (e.g., C5:1 or _:0.5) to #melodyInput or #bassInput and calls updateSongCode().
parseVoiceText(text: string): Array<[string, number]>: Splits comma/whitespace tokens into [noteKey, beatLength] tuples (unknown notes default to '_'; missing beats default to 1).
buildSongObject(): LevelTrack & updateSongCode(): void: Assembles { name, tempo, wave, bassWave, melody, bass } (clamping BPM to 40–320), compares voice beat totals in #beatSyncBadge (flagging .warn if diff > 0.05), and formats the LEVELS object in #songCodeOutput.
#sfxComposerPanel in studio.js) studio.jssyncSfxFieldVisibility(): void: Shows only the input fields matching #sfxMode (sweep, burst, arpeggio, or sequence) and refreshes #sfxCodeOutput.
buildSfxRecipe(): SfxRecipe: Builds a complete recipe object (mode, wave, volume, redirectDelayMs, optional stopMusic, plus mode-specific parameters) and resolves note names from N into Hz.
getSanitizedSfxEntry(): { key: string, recipe: SfxRecipe } & updateSfxCode(): void: Strips invalid characters from #sfxKeyName (exposed globally as window.__getStudioSfx for composer.html bundling) and formats the SFX_DATA snippet.
game.html & theme.js)getActivePalette(): CanvasPalette: Inspects <link id="themeStylesheet"> and returns the matching CANVAS_THEMES palette (barbie, rider, or retro) so canvas colors update live on theme change.
switchMusic(trackIdx: number, label: string): void & updateHud(): void: Updates #statusTag, switches stage tracks (0 World 1-1 → 6 Starman → 14 Coin Heaven), and saves high scores to localStorage (coin_runner_high_score).
resetGame(): void, jump(): void & togglePause(): void: Resets gameplay state, handles primary/double-jump physics (vy = -11.5 / -10) with 'jump' SFX, and toggles pause with 'pause' SFX.
spawnEntity(): void & rectsOverlap(a, b): boolean: Spawns randomized 'coin' (48%), 'fire' (36%), 'star' (9%), and 'heart' (7%) entities and runs Axis-Aligned Bounding Box (AABB) collision checks.
update(): void, draw(): void & loop(): void: Integrates gravity (vy += 0.58), resolves item collisions and SFX (coin, powerup, 1up, fireball, flagpole, gameover), renders the themed 780×280 canvas, and schedules requestAnimationFrame(loop).
applySiteTheme(themeKey, persist): Swaps <link id="themeStylesheet"> to barbieStyles.css, riderStyles.css, or styles.css, saves the choice in localStorage (chiptune_site_theme), and syncs #themeSelect dropdowns across all pages.
chooseAndClose(key, sfx): Invoked by the initial load modal (#themePickerOverlay) when no saved theme or ?theme= URL parameter is present; applies the selected theme, plays a matching SFX ('powerup', 'fireball', or 'coin'), and removes the overlay.