Overview
Add a full in-game audio layer — sound effects for all major game events, optional background music, and persistent volume settings.
Sound Effects
| Event |
Sound |
Trigger |
| Piece selected |
Soft click (50ms) |
Tray hit in handleStart |
| Piece placed |
Thud/knock (120ms) |
Successful placePiece() |
| Line clear |
Swoosh + chime (350ms) |
Each row/col cleared |
| Multi-clear (2+ lines) |
Layered swoosh, brighter chime |
linesCleared >= 2 in one move |
| Combo trigger |
Bass hit + ring (400ms) |
newComboStreak > 0 with lines cleared |
| UNSTOPPABLE tier |
Power-up fanfare (600ms) |
Combo streak reaches 7 |
| Game over |
Descending tone (500ms) |
isGameOver becomes true |
| Score submitted |
Success jingle (800ms) |
On-chain submission confirmed |
| Revival purchased |
Coin sound (300ms) |
Revive confirmed |
| Button tap |
Subtle UI click (30ms) |
All brutal-btn presses |
Background Music
- Off by default, toggled in Settings
- Single ambient loop during gameplay
- Pauses when pause menu is open
- Recommended: "Sneaky Snitch" by Kevin MacLeod (CC BY 4.0) or equivalent 120–135 BPM loop
Volume Controls
Two sliders in Settings:
- Sound Effects — persisted to
localStorage key blokaz:sfx_volume
- Music — persisted to
localStorage key blokaz:music_volume
Implementation
src/audio/AudioManager.ts — singleton with play(event), setMusicVolume(v), setSfxVolume(v), pauseMusic(), resumeMusic()
- Web Audio API directly (no library) for low-latency SFX
- Lazy initialisation on first user gesture (browser autoplay policy)
- Audio files in
public/sounds/ as MP3, <50KB each
- MiniPay: haptic
navigator.vibrate() calls remain — audio is complementary
Files to Change
src/audio/AudioManager.ts — new singleton
src/components/GameScreen.tsx — call AudioManager.play(event) at each game event
src/components/LobbyScreen.tsx — button click audio
- Settings screen — volume sliders
public/sounds/ — audio files
Contract change required: No
Overview
Add a full in-game audio layer — sound effects for all major game events, optional background music, and persistent volume settings.
Sound Effects
handleStartplacePiece()linesCleared >= 2in one movenewComboStreak > 0with lines clearedisGameOverbecomes truebrutal-btnpressesBackground Music
Volume Controls
Two sliders in Settings:
localStoragekeyblokaz:sfx_volumelocalStoragekeyblokaz:music_volumeImplementation
src/audio/AudioManager.ts— singleton withplay(event),setMusicVolume(v),setSfxVolume(v),pauseMusic(),resumeMusic()public/sounds/as MP3, <50KB eachnavigator.vibrate()calls remain — audio is complementaryFiles to Change
src/audio/AudioManager.ts— new singletonsrc/components/GameScreen.tsx— callAudioManager.play(event)at each game eventsrc/components/LobbyScreen.tsx— button click audiopublic/sounds/— audio filesContract change required: No