Skip to content

Self-improving AI Employees for everyone

feat(theme): sound effects on by default — gesture-unlocks AC on first interaction

trohitgaafeb693c32b
diff --git a/client/src/components/ui/SettingsPanel.tsx b/client/src/components/ui/SettingsPanel.tsx
index 17cfccb0..646e157f 100644
--- a/client/src/components/ui/SettingsPanel.tsx
+++ b/client/src/components/ui/SettingsPanel.tsx
@@ -359,13 +359,13 @@ const SettingsPanel: React.FC<SettingsPanelProps> = ({
</Row>
</Section>
- {/* Audio — per-theme WebAudio sound packs. Off by default;
+ {/* Audio — per-theme WebAudio sound packs. On by default;
honours browser autoplay policy (engine resumes on first
- user gesture). */}
+ user gesture via Sounds.unlock()). */}
<Section title="Audio" Icon={Volume2} tone="tool">
<Row
label="Sound Effects"
- description="Play per-theme click / hover / save / error sounds. Each theme ships a different pack (parchment, terminal, marble, ink, clockwork, ...). Disabled by default."
+ description="Play per-theme click / hover / save / error sounds. Each theme ships a different pack (parchment, terminal, marble, ink, clockwork, ...). Enabled by default — toggle off if you prefer silence."
>
<Switch
checked={soundEnabled}
diff --git a/client/src/store/useAppStore.ts b/client/src/store/useAppStore.ts
index 917c5808..78a88246 100644
--- a/client/src/store/useAppStore.ts
+++ b/client/src/store/useAppStore.ts
@@ -51,7 +51,10 @@ interface AppStore {
proMode: boolean; // false = noob mode (only AI categories), true = pro mode (all categories)
/** WebAudio sound effects toggle (per-theme pack picked from
* --sound-pack CSS token by `useSoundSync()`). Persisted to
- * localStorage as `machinaos-sound`; default off (opt-in). */
+ * localStorage as `machinaos-sound`; default ON (user disables in
+ * Settings -> Audio). The AudioContext starts suspended per
+ * browser autoplay policy — `Sounds.unlock()` resumes it on the
+ * user's first interaction (no separate audio permission needed). */
soundEnabled: boolean;
renamingNodeId: string | null;
@@ -173,7 +176,7 @@ export const useAppStore = create<AppStore>((set, get) => ({
componentPaletteVisible: loadBooleanFromStorage(STORAGE_KEYS.componentPaletteVisible, true),
consolePanelVisible: loadBooleanFromStorage(STORAGE_KEYS.consolePanelVisible, false),
proMode: loadBooleanFromStorage(STORAGE_KEYS.proMode, false), // Default to noob mode
- soundEnabled: loadBooleanFromStorage(STORAGE_KEYS.soundEnabled, false), // Opt-in default
+ soundEnabled: loadBooleanFromStorage(STORAGE_KEYS.soundEnabled, true), // On by default; user can disable in Settings -> Audio. Browsers gesture-gate WebAudio (no separate permission), so the AC unlocks on first interaction via Sounds.unlock().
renamingNodeId: null,
// Workflow management
diff --git a/docs-internal/theme_system.md b/docs-internal/theme_system.md
index e09e2f14..be58c77b 100644
--- a/docs-internal/theme_system.md
+++ b/docs-internal/theme_system.md
@@ -237,7 +237,7 @@ Result by theme (display font / tracking / case):
- **Migrated chrome**: TopToolbar, WorkflowSidebar, ComponentPalette + ComponentItem + CollapsibleSection, ConsolePanel chrome, SettingsPanel, Modal, ParameterPanel modal title, AIResultModal title, OutputDisplayPanel title, InputSection title
- **New shell components**: StatusBar (fixed-bottom system line with WS connection / workflow / theme / clock), CommandPalette (`⌘K`), CommandPaletteHost (canonical command list with Workflow / Run / Open / View / Theme groups)
- **Google Fonts** — deferred-load `<link>` covers all 10 themes' typefaces (Cinzel, Cormorant Garamond, IM Fell English / SC, JetBrains Mono, Major Mono Display, VT323, Shippori Mincho, Sawarabi Mincho, Special Elite, Bevan, Lato, Pirata One, EB Garamond, UnifrakturCook, Anonymous Pro, IBM Plex Mono, Courier Prime, Space Mono)
-- **Sound contract** — [client/src/lib/sound.ts](../client/src/lib/sound.ts) ports the upstream WebAudio engine with all 10 packs (`parchment`, `marble`, `ink`, `clockwork`, `vibraphone`, `terminal`, `scrap`, `crypt`, `bell`, `telex`). [client/src/hooks/useSound.ts](../client/src/hooks/useSound.ts) reads `--sound-pack` from `:root` on theme change and mirrors the `soundEnabled` Zustand slice into `Sounds.setEnabled()`. Settings panel ships the toggle (Audio section). Persists to `localStorage['machinaos-sound']`; default off (opt-in).
+- **Sound contract** — [client/src/lib/sound.ts](../client/src/lib/sound.ts) ports the upstream WebAudio engine with all 10 packs (`parchment`, `marble`, `ink`, `clockwork`, `vibraphone`, `terminal`, `scrap`, `crypt`, `bell`, `telex`). [client/src/hooks/useSound.ts](../client/src/hooks/useSound.ts) reads `--sound-pack` from `:root` on theme change and mirrors the `soundEnabled` Zustand slice into `Sounds.setEnabled()`. Settings panel ships the toggle (Audio section). Persists to `localStorage['machinaos-sound']`; **default ON** (browsers gesture-gate WebAudio without a separate permission API — the AudioContext starts suspended and resumes on the user's first pointerdown / keydown / touchstart via `Sounds.unlock()`, registered as a one-shot capture-phase listener in `useSoundSync()`).
- **Canvas overlay packs** — [client/src/hooks/useAppTheme.ts](../client/src/hooks/useAppTheme.ts) extended from 2-way (`{light, dark}`) to 10-way: a `THEME_OVERRIDES` map applies a small overlay (primary, focus, focusRing, action colours, edge palette) on top of `lightColors` / `darkColors`. Existing call sites continue to read `theme.colors.X` and `theme.isDarkMode` unchanged; canvas selection rings, action buttons, and edge strokes pick up the active theme's accents under any of the 10 themes.
### Deferred (future PRs)