๐Ÿ”Š SLOP SOUND DESIGN โ€” OPT-IN UI SOUNDS12 WebAudio sounds: hover, click, success, error, toggle, select, navigate, copy, delete, toast, modal-open, modal-closeMaster volume control โ€ข No autoplay โ€ข Respects reduced motion โ€ข Accessibility firstEnable in Settings (โš™๏ธ) or press the ๐Ÿ”‡ sound button in controls

๐Ÿ”Š Slop Sound Design

Subtle opt-in UI sound system for the web. 12 WebAudio-synthesized sounds with master volume control, no autoplay, and full accessibility support.

๐ŸŽฏ Overview

The freifick.net sound design system provides subtle, non-intrusive audio feedback for user interactions across the site. All sounds are:

Current status: checkingโ€ฆ

๐ŸŽต Sound Catalog

All 12 UI sounds with descriptions and categories. Click any sound to preview it (requires sound enabled).

๐Ÿงช Interactive Demo

Try the sounds in action. Hover over buttons, click them, toggle switches โ€” hear the subtle feedback.

10%

Hover Demo

Form Controls Demo

Toast & Modal Demo

Navigation Demo

Navigate Link

Waveform visualizer โ€” shows the sound wave in real-time

โš™๏ธ Implementation Details

Architecture

AudioContext Management

// Lazy initialization on first user interaction
let audioCtx = null;
function getAudioCtx() {
  if (!audioCtx && typeof AudioContext !== 'undefined') {
    audioCtx = new (window.AudioContext || window.webkitAudioContext)();
  }
  if (audioCtx && audioCtx.state === 'suspended') {
    audioCtx.resume().catch(() => {});
  }
  return audioCtx;
}

Volume Control

// Read from CSS custom property (set by settings page)
function getMasterVolume() {
  const vol = parseFloat(getComputedStyle(document.documentElement)
    .getPropertyValue('--slop-sound-volume'));
  return isNaN(vol) ? 0.1 : vol;
}

Respecting Reduced Motion

// Check global settings and prefers-reduced-motion
function isSoundEnabled() {
  return getSoundOn() && !document.body.classList.contains('slop-sound-disabled');
}

// In play function:
if (slop.reduceMotion) return false; // respect reduced motion

Event System Integration

// Toast sounds
slop.on('toast', () => playUISound('toast'));

// Passport stamp earned
slop.on('stamp', () => playUISound('success'));

// Modal open/close
slop.on('modal-open', () => playUISound('modal-open'));
slop.on('modal-close', () => playUISound('modal-close'));

// Copy events
document.addEventListener('copy', (e) => {
  if (e.isTrusted) playUISound('copy');
});

โ™ฟ Accessibility

Testing Accessibility

  1. Enable Reduce Motion in System Preferences โ†’ Accessibility โ†’ Display
  2. Reload the page โ€” sounds should be automatically disabled
  3. Enable sounds in Settings โ†’ verify they work
  4. Set volume to 0% โ†’ verify no sounds play
  5. Navigate with keyboard โ†’ verify click sounds on Enter/Space

๐ŸŽจ Customization

Disable Specific Sounds

Add data-no-hover-sound, data-no-click-sound, data-no-toggle-sound, or data-no-select-sound to any element to opt it out:

Programmatic Control

// Play a specific sound manually
window.slopUISoundsUI.play('success', 0.5);

// Check current state
console.log(window.slopUISoundsUI.getMasterVolume()); // 0.1
console.log(window.slopUISoundsUI.isSoundEnabled());  // true/false

// Get AudioContext for advanced use
const ctx = window.slopUISoundsUI.getAudioCtx();

Adding Custom Sounds

Edit site/js/ui-sounds-rules.js and add to UI_SOUNDS array:

{
  id: 'custom-sound',
  label: '๐ŸŽต Custom Sound',
  desc: 'A custom sound for my feature',
  category: 'ui',
  play(ctx, volume = 1) {
    const osc = ctx.createOscillator();
    const gain = ctx.createGain();
    osc.type = 'sine';
    osc.frequency.value = 440;
    gain.gain.value = volume * 0.3;
    osc.connect(gain).connect(ctx.destination);
    osc.start();
    osc.stop(ctx.currentTime + 0.2);
  }
}