| File | Layer | Role & Responsibilities |
|---|---|---|
index.html |
Hub, Routing & Toggles | Defines the hidden diagnostic bar (Alt + D / ?debug=1), the live Mode toggle (engine.js vs. engineAuto.js), the Theme selector (theme.js), the Hub view (#hubView), the Dummy Level Stage view (#dummyPageView), and links to the Studio, Game & Docs. |
sounds.js |
Pure Data Layer | Pure data module storing pitch frequencies (N), all 19 two-voice level compositions (LEVELS), and declarative sound effect recipes (SFX_DATA). |
engine.js |
Manual Playback Engine | Synthesizes audio via Web Audio (ChiptuneEngine), provides an HTML5 WAV fallback (playWavBeep), builds UI controls, and intercepts link clicks to play SFX before navigation. Waits for explicit button clicks to start music. |
engineAuto.js |
Autoplay Engine | Adds autoPlayLevel(index) and data-auto-level support to automatically play level music on page load, with a gesture-unlock fallback if the browser suspends autoplay. |
composer.html |
Unified Track & SFX Studio | Interactive 8-bit song editor featuring a chromatic note keyboard, beat-sync meter, preset remix loader, and one-click sounds.js download—plus automatically fetches and embeds SFX.html's designer panel on load. |
SFX.html |
Standalone SFX Designer | Interactive 4-mode SFX builder (sweep, burst, arpeggio, sequence) with built-in preset loader, live testing, and one-click sounds.js download. Works standalone or embedded inside composer.html. |
studio.js |
Shared Studio Controller | Powers both composer.html and SFX.html by detecting #songComposerPanel and/or #sfxComposerPanel, formatting snippets, and exporting merged sounds.js files via downloadUpdatedSoundsJs(). |
game.html |
Arcade Mini-Game | Playable 8-bit runner mini-game (Coin Runner 8-Bit) built on template.html that dynamically switches tracks, triggers gameplay sound effects, and adapts its canvas palette to the active CSS theme. |
template.html |
Subpage Boilerplate | Ready-to-duplicate starter HTML file pre-wired with theme.js, sounds.js, engineAuto.js (data-auto-level="0"), Play/Stop buttons, and retro link-click SFX for creating new pages on your site. |
theme.js |
Page-Load Theme Manager | Prompts visitors on initial page load to choose between barbieStyles.css, riderStyles.css, or styles.css, persists the choice in localStorage, and binds #themeSelect dropdowns across every page. |
styles.css |
Cyber Retro Stylesheet | Default deep-navy and neon-cyan retro arcade stylesheet shared across all HTML pages. |
barbieStyles.css |
Barbie Pink Stylesheet | Feminine pastel bubblegum, hot-magenta, and sparkling gold stylesheet sharing identical selectors with styles.css. |
riderStyles.css |
Night Rider Stylesheet | Masculine obsidian-carbon, brushed gunmetal, and K.I.T.T. scanner crimson stylesheet sharing identical selectors with styles.css. |
info.html |
Modular Docs Loader Shell | Interactive documentation shell that dynamically fetches and injects infoArchitecture.html, infoStudioGame.html, and infoEngineApi.html in parallel on page load with live link-click SFX. |
infoArchitecture.html |
Docs Partial (Sections 1–2) | HTML partial containing this Complete Project File Architecture table and the Browser Sound & FX Debugging guide. |
infoStudioGame.html |
Docs Partial (Sections 3–4) | HTML partial containing the Studio Tools (composer.html, SFX.html, studio.js), Mini-Game (game.html), and Theme Manager (theme.js) API references. |
infoEngineApi.html |
Docs Partial (Sections 5–7) | HTML partial containing the engine.js vs. engineAuto.js comparison, Core Engine API reference, and Quick Usage guide. |
README.md |
Markdown Docs Part 1 | Main Git repository overview, 20-file architecture table, and subpage quick-start tutorial. |
STUDIO_AND_GAME.md |
Markdown Docs Part 2 | Markdown reference guide for composer.html, SFX.html, studio.js, game.html, and theme.js. |
ENGINE_REFERENCE.md |
Markdown Docs Part 3 | Markdown reference guide for engine.js, engineAuto.js, and browser audio/FX debugging. |
index.html includes a hidden diagnostic bar (#diagBar) that remains invisible in production until triggered.
index.html to toggle the diagnostic bar on or off, or open index.html?debug=1 to reveal it immediately on load.🔊 1. Test WebAudio Beep: Unlocks AudioContext and plays a 440Hz sine wave for 0.45s while reporting RUNNING or SUSPENDED state and sample rate in #audioStatus.
📻 2. Test HTML5 Audio Beep: Generates a binary 8-bit mono RIFF/WAVE file in memory via ArrayBuffer and plays it through a standard HTML5 <audio> tag. If button 2 plays sound while button 1 is silent, Web Audio is blocked by a browser sandbox; if neither plays sound, check OS speaker routing, tab mute, or site sound permissions.
// Verify loaded tracks and SFX keys
console.log('Tracks:', LEVELS.length, 'SFX:', Object.keys(SFX_DATA));
// Audition any sound effect immediately without page navigation
soundtrack.playSFX('jump');
soundtrack.playSFX('coin');
// Start or stop any level track (0 to 18)
soundtrack.playLevel(0);
soundtrack.stop();
// Inspect Web Audio context state
console.log(soundtrack.ctx?.state, soundtrack.ctx?.sampleRate);