summaryrefslogtreecommitdiff
path: root/internal/generator/templates/shared/shared.js
AgeCommit message (Collapse)Author
6 daysReset persisted theme after publishing and release v0.19.3v0.19.3mainPaul Buetow
Amp-Thread-ID: https://ampcode.com/threads/T-019fc31d-668a-769a-8dc8-554ecbd6a274 Co-authored-by: Amp <amp@ampcode.com>
2026-07-05Add splash screen choice to enter with or without background music (js0)Paul Buetow
Injects an explicit "With music" / "Without music" choice into the splash overlay at runtime (uniformly across all themes) instead of only letting visitors discover the 'p' ambient shortcut after they're already inside. Clicking a button saves the preference, starts/pauses the ambient engine, and dismisses the splash. Re-injected after the two spots that replace #splash-overlay's innerHTML wholesale (theme switch / theme-meta swap) so the buttons survive. Also fixes a keyboard-focus bug this introduced: the splash's document-level Enter/Space handler was swallowing native button activation for a Tab-focused choice button. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-06-03Add per-post share button with permalink (mobile view)Paul Buetow
Each post now exposes a share button in its header that surfaces only on mobile. Clicking it invokes navigator.share() with a permalink of the form "<page>#post-<ID>", which the existing deep-link handler in shared.js already opens directly in the modal. When navigator.share is unavailable the link is copied to the clipboard and a brief toast confirms the action; very old browsers fall back to window.prompt. Amp-Thread-ID: https://ampcode.com/threads/T-019e8f2a-b58e-72b3-b572-28d1fb1d9a1d Co-authored-by: Amp <amp@ampcode.com>
2026-05-16Add theme background musicv0.16.0Paul Buetow
2026-05-01Handle scroll-driven post selection for task bPaul Buetow
2026-04-27Add blank mode toggle (b key) and theme-hot-swap + Nukem sounds reworkPaul Buetow
- New blank mode hides all UI except the WebGL canvas; toggled via the ‘blank’ nav button or the b key. - Theme switching is now in-place (no page reload), avoiding the Web Audio context reset that used to kill ambient music. - Nukem ambient/riff rebuilt around the classic Grabbag riff (E5 E5 G5 A5 …).
2026-04-26audio: make ambient music polyphonic with real songs, fix engine silencePaul Buetow
Rewrite all 19 theme ambient presets with chord progressions, bass drones, overlapping chord pads (dur > step on melodyNote), and swing melodies. Add per-theme 16-step drum patterns (kick, snare, hat, clap) synthesized in the Web Audio engine. Go (theme_sounds.go): - Add Step field to melodyNote for sequencer timing independent of duration - Add Drums []string field to ambientPreset for 16-step patterns - Add buildMeasure, buildSong, buildSwingMelody, and pat helpers - Rewrite every sounds*() func with I–IV–V–I progressions, bass, and melody JS (shared.js): - Fix startEngine() to await ctx.resume() before scheduling - Make masterGain a binary gate (fade to 1.0 in ~50 ms), not preset.gain - Fix startDrones() to scale by preset.gain instead of 1.0/numDrones - Add twin-oscillator detuned timbre in playMelodyNote() - Add synthesized drum engine: playDrum(), scheduleDrums(), stopDrums() - Keep splash sounds bypassing masterGain so they never get gated out
2026-04-26ambient: polyphonic songs, fix cascaded gain and resume bugsPaul Buetow
Rewrite all 19 theme melodies into proper ~10-16 second looping songs with bass drones, chord pads, and scalar melody lines using the new 'step' field for polyphonic overlap on a monophonic step sequencer. Fix four bugs that caused total silence: 1. masterGain was faded to preset.gain while each note was ALSO scaled by preset.gain*0.6, squaring volume to ~-68 dB. 2. fadeMasterTo ramped the gate for 0.5-1.5s, swallowing first notes. 3. startDrones set per-osc gain to 1.0/numDrones, clipping and burying the melody. 4. AudioContext resume was not awaited; notes fired into a suspended context and were lost. Shared.js: - startEngine() waits for ctx.resume() before scheduling anything. - masterGain acts as a binary gate (fades to 1.0 over 50ms). - playMelodyNote uses twin detuned oscillators for richer timbre. - startDrones scales by preset.gain so drones match melody level. Theme_sounds.go: - Add 'step' field to melodyNote struct. - Add chord-building helpers (major/minor triads). - Add buildSong() / buildMeasure() for structured 4-bar loops. - All 19 themes: audible bass (130-220Hz), chord pads (260-520Hz), melodies (330-1046Hz), real chord progressions, proper BPM.
2026-04-26Add unique ambient melodies for all 19 themesPaul Buetow
Each theme now has a distinctive looping melodic phrase (normal + wild variants) played by the Web Audio ambient engine. This replaces the generic random-pulse behavior that made all themes sound the same. Go changes: - Add melodyNote struct with freq/dur/gain fields to ambientPreset - Add n() helper for concise melody construction - Rewrite all 19 theme presets with unique melodic phrases: neon=glassy arpeggio, terminal=sparse CRT beeps, synthwave=warm minor, plasma=tritone shimmer, brutalist=concrete rumble, volcano=phrygian, aurora=high shimmer, matrix=digital ostinato, ocean=wave flow, dos=8-bit arpeggio, retro=VHS warmth, cosmos=vast fifths, retrofuture=lounge minor-7, spaceage=pure ascending, tropicale=pentatonic, noir=smoky minor-7, cathedral=organ thirds, surveillance=fourth alert, biomech=diminished unease JS changes: - Add melodyTimer/melodyIndex state to ambient engine - Add playMelodyNote() with per-note gain and filter support - Add scheduleMelodyNote() with phrase-rest gaps - schedulePulse() now routes to melody player when melody is present - Add sawtooth support to snonuxWaveType() - Reset melody index on startEngine() and stopAll() Test changes: - TestThemeSoundPresetsAmbientPopulated now accepts melody as valid content - TestThemeSoundPresetsAmbientValuesBounded validates melody note freq/dur
2026-04-25Fix splash screen Enter/Space key not playing chime soundPaul Buetow
The splash overlay played its chime on pointerdown (click) but not when dismissing via Enter or Space. Expose playSplashChime on window so the global keydown handler can trigger the same sound before dismissal. Escape continues to dismiss silently.
2026-04-25Make ambient music react to wild modePaul Buetow
- When wild mode turns on, automatically start ambient playback using the theme's wild ambient variant, even if normal ambience was off. - Track wild-forced ambient starts via _snonuxAmbientWildForced so that deactivation can fade to silence when the user never opted in, or crossfade back to normal when they did. - Do not persist forced-wild playback as a normal ambient preference; only user toggles (p key / ambient button) are saved. - Enhance wild ambient playback: denser pulses (1.5x bpm), increased noise texture, slightly raised gain (capped at 0.15), and deeper lowpass filter sweeps on pulses. - Re-sync FX button states after ambient start/stop so the ambient button accurately reflects the current state.
2026-04-25Add opt-in ambient music control (task o8)Paul Buetow
- Change ambient playback hotkey from 'm' to 'p' - Move flash effect hotkey from 'p' to 'f' - Update nav button labels: '<kbd>p</kbd> music' and '<kbd>f</kbd> flash' - Update splash hint to advertise 'p' music alongside 'w' wild - Add 'p' and 'f' hotkey support in splash and modal states - Persist ambient enabled/disabled state in localStorage (snonuxAmbientEnabled) - Default off; restore preference on page load without overwriting via wild mode - Improve accessibility with explicit aria-labels and aria-pressed state sync
2026-04-25Implement shared Web Audio ambient enginePaul Buetow
Adds a reusable ambient controller in shared.js with: - One shared AudioContext + master gain node for all ambient sound - Long-running drone oscillators from SNONUX_SOUNDS.ambient droneFreqs - Scheduled short pulse oscillators with BPM-derived interval jitter - Looped buffer-source noise when noiseGain is present (no AudioWorklet) - Fade in/out (~0.3-0.8s) using preset attack/release on start/pause/switch - snonuxAmbientStart/Pause/Toggle/SetWild/SyncPreset/IsPlaying window APIs Integrates with existing UI: - Ambient toggle button (<kbd>m</kbd> ambient) in nav-fx-buttons - m hotkey toggles ambient in both splash and main keyboard handlers - w key starts wild ambient and crossfades preset when switching wild state - Theme sounds.json fetch completion triggers snonuxAmbientSyncPreset() - One-shot UI sounds (splash/nav/open/close/bounce) remain unchanged and route through their own AudioContexts, never through the ambient master.
2026-04-25can swap themes dynamicallyv0.12.0Paul Buetow