Skip to content

Music, session controls and UI upgrades - #5

Merged
HalcyonVector merged 5 commits into
mainfrom
feature/music-session-upgrades
Oct 31, 2026
Merged

HalcyonVector merged 5 commits into
mainfrom
feature/music-session-upgrades

Conversation

@HalcyonVector

@HalcyonVector HalcyonVector commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

Music

  • Daily key: each day has its own key, stepping around the circle of fifths (a picked city uses its own date) instead of always C.
  • Real chord progressions: chords build and resolve (ii/IV to V to I) instead of a random walk; the bass plays each chord's root.
  • Phrase-safe changes: key and mode changes wait for the next chord and land on the new home chord.
  • Lo-fi drum groove: synthesized kick and rim click with swing, sparse at night and fuller by day or when active, with its own mixer channel.
  • Temperature now also shapes pad swell and pluck brightness.

Playback fixes

  • Crackles and pops: the audio uses a larger buffer and more scheduling lookahead (ambient playback doesn't need low latency), plus a -1 dB output limiter and a cap on overlapping pad voices.
  • New deploys show on the first reload: the service worker now loads pages network-first (cache only as the offline fallback), so visitors no longer see the previous release after a deploy.

Session controls

  • Sleep timer (15/30/60/90 min): fades out over the last 30 seconds, then stops, with a countdown in the tray.
  • Focus mode: calmer chords, an arp that ignores typing, soft drums, no thunder. Saved presets and share links keep the unfocused sound.

UI

  • Tray: shows where the weather is from and the chord playing now, highlights the key when it changes, has a visible glowing waveform, labeled Rec/Studio buttons, and says WEATHER OFFLINE (with retries) instead of loading forever.
  • The sky reacts to the music: the sun/moon glow pulses with the kick, stars flare on notes, and the light washes warm or cool with each chord (off under reduced motion).
  • Studio tabs: Sound / Source / Presets instead of one long scroll; arrow keys switch tabs.
  • Larger wordmark, "or press Space" hint on keyboard devices, fixed grey hover on selected buttons.

Housekeeping

  • GitHub Actions CI: both test suites plus a client build on every push and PR.
  • Maskable PWA icon so phone launchers don't crop it.
  • Build cache file untracked and ignored; repository rules file added.
  • Older presets, share links and saved mixer levels keep working.

Testing

  • 13 server and 126 client tests pass, typecheck clean, production build succeeds.
  • Checked in a real browser on desktop and phone sizes: playback, Studio tabs and keyboard navigation, sleep timer fade and stop, sky reactions, and the service worker update and offline behaviour.
  • Not verifiable here: how it actually sounds (crackles, drum levels) needs a listen on a real device.

- Run on a "playback" latency audio context with a 0.25 s lookahead instead
  of Tone's lowest-latency default. Ambient playback doesn't need low
  latency, and the larger buffer keeps the audio thread from running dry
  (heard as crackles) when the pads, reverb, drums and animated sky are all
  busy. Uses Tone.getTransport() since Tone.Transport is bound to the
  original context.
- Unlock audio before building the graph.
- Limiter at -1 dB on the output to catch thunder/chord spikes.
- Cap pad polyphony at 16 voices to bound CPU cost.
- Short bass glide now that the bass follows chord roots.
- Only push pad/pluck tone settings to the synths when they change.
- When the weather fetch fails with no earlier reading, the tray says
  WEATHER OFFLINE (and the Studio readout explains that typical mild
  weather is used meanwhile) instead of LOADING forever. Failed fetches
  retry after 30s, 60s, 120s... up to the normal 10 minute refresh.
- Waveform redrawn: crisp at any pixel density, smoothly auto-gained so
  quiet ambient audio fills the strip, a soft glowing brass/blue line with
  a faint fill. While stopped it breathes gently instead of leaving a gap
  (still under prefers-reduced-motion).
- Record and Studio are labeled pill buttons with proper icons ("Rec",
  "Studio"); icon-only on very narrow phones. Onboarding text now names the
  Studio instead of a gear glyph.
- The engine now emits chord, arp-note and kick events, delivered in sync
  with the audio through Tone's Draw scheduler.
- Sky reactions (sky/useSkyReactions.ts, Web Animations API, no React
  re-renders): the sun/moon glow pulses with each kick, a star flares on
  arp notes (a drifting mote by day or under cloud), and the light washes
  warm on major chords and cool on minor ones, stronger on a key change.
  Skipped under prefers-reduced-motion and while the tab is hidden.
- Tray shows where the weather is from (picked city, "Your location",
  "Approximate location", "Default location", "Simulated weather"), the
  chord playing now (e.g. "Am"), and briefly highlights the key when the
  key or mode changes.
- chordName/triadQuality in musicTheory.ts, with tests.
- The Studio drawer is split into three tabs instead of one long scroll:
  Sound (focus mode, sleep timer, mixer), Source (Live/Simulate, location,
  input and parameter readout) and Presets. Proper tablist/tab/tabpanel
  roles, arrow keys move between tabs.
- Larger, higher-contrast PETRICHOR wordmark.
- "Or press Space" hint under the tray while stopped, on devices with a
  keyboard only; play button tooltip mentions Space too.
- README updated for the new tray, sky reactions, Studio tabs and the
  crackle fix.
Page loads were served stale-while-revalidate, so after each deploy the
first visit still showed the previous release (its HTML points at the old
hashed bundles), and only a second reload showed the update. Page loads are
now network-first with the cache as the offline fallback; hashed assets
stay cache-first. Cache renamed so old caches are cleared on activation.
@HalcyonVector
HalcyonVector merged commit a74d18a into main Oct 31, 2026
2 checks 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.

1 participant