Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / docs / sound-haptics-audit.md
| 1 | # Sound & Haptics Audit — Modern-Apps |
| 2 | |
| 3 | Read-only audit, 2026-12-01, worktree `wt-sound-audit` (branch `agent-sound-audit`, HEAD 8eb187ecd). Scope: all Gradle app modules in root `AGENTS.md`/`settings.gradle.kts` + `library/ui`, `sdk/games`. No app code changed. |
| 4 | |
| 5 | **Candidates: 56 — high 23, medium 26, low 7.** |
| 6 | |
| 7 | ## Existing infrastructure today |
| 8 | |
| 9 | - **Shared haptics (the one shared helper that exists):** `library/ui/.../Haptics.kt` — `rememberHaptics()` wrapping `LocalHapticFeedback` with named `longPress()/keyPress()/tick()/confirm()/reject()`. Adopted in calculator, communicate DialPad, keyboard (`KeyHaptics.kt`), launcher drag, maps chips/dropdowns, todo, games chess/minesweeper/nonogram/logicgate, notes/weather/youpipe (raw `LocalHapticFeedback` SegmentFrequentTick/Gesture* drag patterns), camera (`CameraScreen.kt:64` posts `HapticFeedbackConstants.CLOCK_TICK` for shutter — haptic only, no sound), clock (`ClockScreen.kt` SegmentFrequentTick/Gesture*). |
| 10 | - **Full sound+vibration services (reference patterns):** clock `AlarmSoundService` (MediaPlayer ringtone, `RingtoneManager.TYPE_ALARM`, waveform vibration, per-alarm vibrate pref `KEY_DEFAULT_VIBRATE`); health `DoseSoundService` + `MedicationChannels` (channel defers sound/vibration to the service); communicate `CallRinger` (MediaPlayer + `ToneGenerator` call-waiting, ring vibration via `USAGE_RINGTONE`, respects ringer mode via `RingEnvironmentReader`); emergency `SosSound`/`SosCountdownService` (ToneGenerator alarm stream); clock-wear `WearRingActivity`. |
| 11 | - **Only synthesised game SFX:** voxels `platform/SoundFx.kt` — SoundPool over WAVs *generated at runtime by code synthesis* (break/place/hurt/eat/explode/steps/cave/stalk), `sfxVolume` in `GameSettings`/`SettingsSheet`. This conflicts with the owner's new asset preference (see below). |
| 12 | - **Keyboard:** `KeyboardPrefs` (`kb_haptic`=true, `kb_sound`=false) + `AudioManager.playSoundEffect(FX_KEYPRESS_STANDARD)` — the model per-app settings pair. |
| 13 | - **Ringtone picking:** shared `library/ui/RingtonePicker.kt`; used by clock alarms, contacts per-contact ringtone. |
| 14 | - **Notifications as sound:** findfamily per-person arrival/departure/no-show channels (`FindFamilyNotificationChannels`, IMPORTANCE_HIGH, system-tunable), communicate conversation channels. Several foreground-service channels deliberately `setSound(null)/enableVibration(false)` because a service/ringer owns sound — correct only where that owner exists. |
| 15 | - **Settings today:** per-app only — clock alarm vibrate+ringtone, voxels sfxVolume, keyboard haptic/sound, measure `measure_haptics`. No global sound/haptics toggle, no shared SFX player, no sound assets anywhere (`res/raw` empty repo-wide; only voxels music `.ogg` assets exist). |
| 16 | - **In-flight (do not duplicate):** minesweeper explosion (`wt-mines-sound`: `ExplosionSoundPlayer` in `MinesweeperViewModel`, gated by ringer mode, no toggle yet); camera shutter sound (separate agent, owner-confirmed should-have). |
| 17 | - Permissions: VIBRATE declared in calculator, clock, communicate, emergency, health, games/hub, clock-wear. Any new vibration in other apps needs it added. |
| 18 | |
| 19 | ## Candidates |
| 20 | |
| 21 | | # | App | Screen / action (file) | Trigger moment | Type | Suggested character | Priority | Justification | |
| 22 | |---|---|---|---|---|---|---|---| |
| 23 | | 1 | camera | CameraScreen.kt / CameraPhotoCapture.kt (shutterFeedback) | Photo captured (incl. volume-key shutter, burst, timer self-shot) | Both | shutter click (real asset) + short tick haptic | high | Owner-confirmed should-have; capture moment is currently visual-only flash. IN-FLIGHT: separate agent implementing. | |
| 24 | | 2 | camera | CameraScreen.kt video modes | Video record start / stop | Both | start beep + stop double-beep; confirm haptic | high | Recording state must be confirmable without looking at the red dot. | |
| 25 | | 3 | camera | CameraScreen.kt timer mode | Shutter-timer countdown last 3s / final shot | SFX | countdown ticks, final shutter | medium | Lets subject pose without watching screen. | |
| 26 | | 4 | clock | platform/TimerReciever.kt + TimerPage.kt | Timer expires | Both | timer alarm (user ringtone) + repeating vibration | high | A timer that only posts a notification is missable; alarms already ring via AlarmSoundService, timers should match. | |
| 27 | | 5 | clock | ui/StopwatchScreen.kt (addLap) | Lap recorded; start/pause | Vibration | lap: segment tick; start/pause: confirm/reject haptic | medium | Eyes-free lap timing is the stopwatch's main use case. | |
| 28 | | 6 | clock | ui/AlarmPage.kt | Alarm fires (existing AlarmSoundService) | Both | EXISTING: ringtone MediaPlayer + waveform vibration | high | Already implemented well — keep as reference pattern, no change. | |
| 29 | | 7 | communicate | telephony/CallRinger.kt | Incoming call / call waiting | Both | EXISTING: ringtone + ToneGenerator call-waiting + ring vibration | high | Already implemented; respects ringer mode via RingEnvironmentReader. Reference pattern. | |
| 30 | | 8 | communicate | ui chat thread (Conversation/Message compose) | Message sent; message received while thread open | Both | sent: soft swoosh/pop; received: gentle blip; confirm haptic on send | high | IM affordance users expect; distinguishes own send from arrival without looking. | |
| 31 | | 9 | communicate | ui/call/InAppCallScreen.kt | Call connected / ended / muted / hold; DTMF keys (DialPad.kt) | Both | connect chime, end tone, key DTMF tones; tick haptics (DialPad already has rememberHaptics) | medium | Call state changes are often eyes-free (phone to ear). | |
| 32 | | 10 | communicate | notifications/ConversationSpace.kt | New message notification | Both | EXISTING channel IMPORTANCE_HIGH; verify sound/vibration defaults not silenced | medium | Several services setSound(null)/enableVibration(false) for foreground channels — audit each is compensated by a ringer, not silent overall. | |
| 33 | | 11 | games/minesweeper | ui/components/MineFieldGrid.kt + MinesweeperViewModel | Mine hit (explosion); win; flag place/remove; first reveal | Both | explosion asset; win fanfare; flag tick | high | Explosion IN-FLIGHT (wt-mines-sound, ExplosionSoundPlayer, ringer-mode gated). Win/flag are the remaining gaps. | |
| 34 | | 12 | games/voxels | platform/SoundFx.kt + MusicFx | Break/place/hurt/eat/explode/steps/cave | SFX | EXISTING but runtime-synthesised WAVs | high | Only game with SFX today. Owner preference is real locally-generated asset files over code synthesis — migrate generated WAVs to committed assets; keep sfxVolume setting. | |
| 35 | | 13 | games/hub | ui/components/AchievementRow.kt + sdk/games Models.kt | Achievement unlocked / level-up / XP tier up | Both | success chime / level-up arpeggio + confirm haptic | high | Unlocks are the hub's reward moment; currently silent. sdk/games syncAchievementProgress is the trigger point. | |
| 36 | | 14 | games/chess | BoardGrid.kt (already rememberHaptics) | Move, capture, check, checkmate/stalemate, illegal move | Both | move click, capture thud, check alert, game-end motif; reject haptic on illegal | high | Board-game turn feedback; capture/check are information, not decoration. | |
| 37 | | 15 | games/solitaire | ui/DraggableCard.kt, DropTarget.kt, FoundationSlot.kt | Card pickup/drop, invalid drop, foundation complete, win | Both | card slide/flip, reject buzz on invalid, win cascade chime | high | Drag validity is currently purely visual; win is a headline moment. | |
| 38 | | 16 | games/sudoku | ui/GameScreen.kt / GameBoardScreen.kt | Correct entry, wrong entry, puzzle complete, hint used | Both | soft pencil tick, error buzz + reject haptic, success chime | medium | Wrong-entry feedback speeds play; must be subtle to avoid punishing. | |
| 39 | | 17 | games/nonogram | ui/components/NonogramBoard.kt (already rememberHaptics) | Cell fill/mark, mistake, row/column complete, puzzle complete | Both | fill tick, error buzz, line-complete sweep, win chime | medium | Line completion is satisfying and currently unmarked. | |
| 40 | | 18 | games/pipes | ui/GameBoard.kt | Pipe rotate, connection completed, level solved | SFX+B | rotate click, flow-complete rising tone, win chime; tick haptic | medium | Connection completion is the core reward loop. | |
| 41 | | 19 | games/logicgate | ui/GameScreen.kt/CircuitCanvas.kt (already rememberHaptics) | Gate placed, wire connected, circuit output correct/wrong, level complete | Both | place click, power-on hum blip, error buzz, success chime | medium | Correct-output moment teaches; should feel like power flowing. | |
| 42 | | 20 | games/arrows | ui/components/ArrowsBoard.kt | Arrow slide, blocked move, puzzle solved | Both | slide swish, blocked thud+reject, win chime | medium | Blocked vs moved is not distinguishable by feel today. | |
| 43 | | 21 | games/unblockjam | ui/components/GameBlock.kt | Block slide, blocked, exit cleared, level win | Both | wood slide, thud, exit fanfare | medium | Same slide/block distinction as arrows. | |
| 44 | | 22 | games/wordmaker | ui/WordGameScreen.kt/WordGameOverlays.kt | Valid word, invalid word, letter placed, game over/win, turn change (competitive) | Both | letter tick, error buzz, word-accept chime, turn alert | medium | Word validity is the whole game loop. | |
| 45 | | 23 | games/kart | ui/KartSurfaceView.kt/KartGameScreen.kt | Countdown, lap, collision, finish, checkpoint | SFX | 3-2-1 beeps + go, lap chime, crash thud, finish motif | high | Racing without audio loses speed/collision feedback; countdown beeps are accessibility-relevant. | |
| 46 | | 24 | games (all) | sdk/games + hub | Your turn in turn-based/multiplayer (chess, wordmaker competitive) | Both | turn alert blip + vibration | medium | Prevents stalled games; only when app backgrounded use notification channel. | |
| 47 | | 25 | findfamily | notifications/FindFamilyNotificationChannels.kt (arrival/departure per-person channels) | Family member arrives / departs a place | Both | arrive: two-note chime; depart: falling tone; per-person channel sound/vibration already user-tunable in system settings | high | Core promise of the app; channels exist (IMPORTANCE_HIGH) — verify default sound not null and add distinct arrive vs depart assets. | |
| 48 | | 26 | findfamily | notifications (no-show channel) | No-show alert (member didn't arrive) | Both | alert tone + stronger vibration pattern | high | Safety-relevant; must cut through, distinct from routine arrival. | |
| 49 | | 27 | findfamily | ui map (MainMapSlot/PersonDetailSheet) | UWB/distance: target in range; tracking lost | Vibration | proximity ticks speeding up; lost: reject pattern | medium | Eyes-free finding (phone in pocket) is a real use case; UWB channel already HIGH. | |
| 50 | | 28 | weather | weather alerts (HomePage/forecast) | Severe weather alert issued for saved location | Both | severe-alert tone + distinct vibration; notification channel | high | Safety-relevant and time-sensitive; routine forecast refresh must stay silent. | |
| 51 | | 29 | weather | ui/LocationsScreen.kt (already haptics) | Location added/removed, refresh complete | Vibration | confirm/reject via existing rememberHaptics pattern | low | Drag/reorder already ticks; completion confirm is cheap consistency. | |
| 52 | | 30 | health | service/DoseSoundService.kt | Medication dose due | Both | EXISTING: alarm ringtone + waveform vibration | high | Already implemented — reference pattern; channels in MedicationChannels.kt correctly defer to service. | |
| 53 | | 31 | health | ui medication log | Dose marked taken / skipped; measurement saved | Vibration | confirm haptic; soft success tick (SFX low) | medium | Logging adherence should feel recorded; avoid alarm-like sounds for routine logs. | |
| 54 | | 32 | todo | ui/TodoListScreen.kt (already rememberHaptics) | Task completed (checkbox/swipe), un-complete, delete | Both | complete: success tick/chime-lite; delete: reject-pattern haptic only | high | Completion is the app's reward moment; highest-frequency candidate in the suite. | |
| 55 | | 33 | calendar | event reminder notifications; ui event editor | Reminder fires; event saved/deleted | Both | reminder: notification sound+vibration (channel); save: confirm haptic | medium | Reminders are missable if channel is silent; editor feedback is consistency. | |
| 56 | | 34 | email / securemail | compose send; inbox | Mail sent; send failed; new-mail (background) | Both | sent swoosh + confirm; failed: error buzz; background via notification channel only | medium | Send success/failure is frequently acted on without watching. | |
| 57 | | 35 | files | ui/DirectoryListing + dialogs | Delete (permanent), move/copy complete, operation failed | Vibration (+SFX low) | delete confirm: reject/confirm haptics; failure error buzz | medium | Destructive-action weight should be felt; success SFX optional/low. | |
| 58 | | 36 | photos | ui viewer/editor | Photo deleted, favourite toggled, edit applied, video playback start | Vibration | favourite confirm tick; delete haptic; no SFX (media app, avoid competing audio) | low | Photos is a media surface; haptics only, respect audio focus. | |
| 59 | | 37 | camera-adjacent: pdf | ui/CapturePdfScreen/CropScreen | Page captured, OCR complete, export done/failed | Both | capture shutter-lite click, success chime, error buzz | medium | Scan capture mirrors camera shutter expectation. | |
| 60 | | 38 | measure | ui/LevelContent, CompassContent, ArMeasureContent | Level becomes level (0°), compass north lock, AR point placed/measurement complete | Both | level-lock tick/beep + confirm haptic; point-place tick | high | Eyes-on-the-object, not the screen: level-lock is the textbook haptic case. hapticsEnabled setting already exists (KEY_HAPTICS) — wire it consistently. | |
| 61 | | 39 | tuner | ui/TuningMeter.kt | Note enters in-tune band; string in tune | Both | in-tune beep/chime (optional, toggleable) + confirm haptic | high | Tuning is eyes-on-instrument; audible in-tune cue is the feature users ask tuners for. NOTE: no metronome exists in tuner today — a metronome (beat click + flash, accent first beat) is a new-feature candidate, flag separately. | |
| 62 | | 40 | tuner (new) | metronome (does not exist) | Beat / accented downbeat | SFX | click asset, accent higher click | medium | Common tuner companion; scope as new feature, not feedback retrofit. | |
| 63 | | 41 | music / youpipe / uniflix | player screens | Track/video end, queue complete, download complete, playback error | Vibration/notification | haptics only in-player (never SFX over media); download-done notification sound | low | Never compete with the media audio itself; audio-focus etiquette. | |
| 64 | | 42 | flashcards | ui study session | Card flipped, answer correct/wrong, deck completed, streak | Both | flip tick, correct chime, wrong buzz, completion fanfare-lite | medium | Study reward loop; wrong-answer must be gentle. | |
| 65 | | 43 | education | ui CoursePage/BadgesPage + Narrator (TTS exists) | Lesson complete, badge earned, correct/wrong answer (K-2 audio-first shell) | Both | success fanfare, badge chime, gentle error; haptics confirm | high | Young learners: audio feedback is pedagogy, not polish. TTS Narrator already exists. | |
| 66 | | 44 | calculator | ui/CalculatorKeypad.kt (rememberHaptics) + widget (VibrationEffect EFFECT_TICK) | Key press, equals, error (div/0) | Vibration (SFX optional) | key tick exists via haptics; equals confirm; error reject | low | Already haptic'd; add only error reject + optional key click sound gated by setting. | |
| 67 | | 45 | keyboard | platform/ime/KeyboardServiceEditOps.kt AudioManager.playSoundEffect + KeyboardPrefs (sound=false, haptic=true) | Key press, delete repeat, space/swipe commit | Both | EXISTING: FX_KEYPRESS_STANDARD gated by kb_sound; haptics gated by kb_haptic | medium | Already implemented with prefs — reference settings pattern. Default sound off is correct. | |
| 68 | | 46 | launcher | ui/components/DragFeedback.kt (rememberHaptics) | App launch, drag pickup/drop, folder open, uninstall drop target | Vibration | launch tick, drop confirm, trash reject-pattern | medium | Pickup/drop already haptic'd; launch tick is the missing beat. | |
| 69 | | 47 | maps | navigation (NavMapScreen/platform), ui CategoryChips | Turn instruction point, reroute, arrival, off-route | Both | turn beep/voice-adjacent cue, arrival chime, off-route alert; vibration on turn approach (wear) | high | Eyes-on-road: arrival and reroute must be non-visual. Wear turn vibration is high value. | |
| 70 | | 48 | taxi / fooddelivery / shop / travel / globalesim | order & booking flows (CartScreen, CurrentRideScreen, ConfirmationPage) | Order placed, driver assigned/arriving, payment success/fail, booking confirmed, delivery delivered | Both | success chime + confirm; payment fail error buzz; driver-arriving alert tone+vibration | high | Money/state transitions users wait on with screen off; payment failure must not be silent. | |
| 71 | | 49 | news | ui/FeedScreen/ReaderScreen | Refresh complete, breaking-news (if opted in), save article | Vibration/notification | refresh confirm tick only; breaking via channel if user opts in | low | News should default quiet; only opt-in breaking alerts. | |
| 72 | | 50 | notes | ui/NotesListScreen.kt (haptics exist) | Note saved, checklist item done, note deleted, ink stroke (tablet) | Vibration | existing drag ticks; add save confirm + checklist tick | low | Mostly covered; checklist tick is the gap. | |
| 73 | | 51 | passwords / backup / everysync / vpn / euicc / updater / appstore | unlock, sync, connect, install flows | Unlock success/fail (biometric), sync complete/failed, VPN connected/disconnected, eSIM download done, update installed, app install complete | Both | unlock fail error buzz; sync/install success chime-lite + confirm; VPN connect/disconnect two-tone | medium | Security/sync state changes are background-y; failure buzz on unlock is accessibility-relevant. Biometric prompt itself is system-owned — do not duplicate. | |
| 74 | | 52 | emergency | platform/SosSound.kt + SosCountdownService | SOS countdown + SOS sent | Both | EXISTING: ToneGenerator alarm-stream + waveform vibration | high | Already implemented deliberately — do not touch; reference for alarm-stream usage. | |
| 75 | | 53 | setupwizard / parentalcontrols / screentime | FinishScreen; LockScreen; limit reached | Setup complete; device locked; app-limit reached block | Both | completion chime; limit-reached: firm buzz + tone (child device) | medium | Limit-reached is currently a visual screen a child can miss/ignore. | |
| 76 | | 54 | share / cast / auto | SharePopup, CastContent, auto AppScreen | Share sent/failed, cast connected/disconnected, car connection | Both | sent confirm, cast connect two-tone, disconnect falling tone | medium | Connection state on another screen (TV) needs phone-side confirmation. | |
| 77 | | 55 | astronomy / code / logviewer / speech / translate / things / networklocation / office / web / openassistant | various | Object found (astronomy go-to aligned), run/test complete (code), error spike (logviewer), TTS done, translation spoken, device toggled (things), fix acquired, doc saved, download complete (web), assistant reply (openassistant) | Vibration mostly | single confirm/tick each; things device-on/off two-tick; astronomy alignment-in-range speeding ticks | low | Long-tail consistency via shared helper; individually low, collectively the reason to build it once. | |
| 78 | | 56 | watch / wear apps | clock-wear WearRingActivity (EXISTS: ringtone+vibration), calendar-wear, maps-wear, todo-wear, findfamily-wear, music-wear | Alarm on wrist, turn-by-turn, task done, member arrival | Vibration primary | wear: vibration patterns only (speaker-less use), already correct for alarm | medium | Wear is haptics-first; replicate phone patterns as vibration-only variants. | |
| 79 | |
| 80 | ## Shared helper proposal |
| 81 | |
| 82 | **Where:** new `library/sound` Gradle module (`library:sound`, like `library:format` — small, opt-in), plus extend the existing `library/ui` `Haptics`. Do not put SoundPool code in `library/ui` (it owns Compose scaffold/icons; sound is platform, cf. every app's `platform/` rule). Games that need achievements-triggered sounds consume it the same way. |
| 83 | |
| 84 | **API shape:** |
| 85 | ```kotlin |
| 86 | // library/sound |
| 87 | enum class SoundCue { Click, Confirm, Success, Error, Shutter, Explosion, TurnAlert, AlarmLite, /*…*/ } |
| 88 | interface SoundSettings { val soundEnabled: Boolean; val hapticsEnabled: Boolean; val volume: Float } |
| 89 | class AppSounds(context: Context, settings: () -> SoundSettings) { |
| 90 | fun play(cue: SoundCue) // SoundPool over res/raw assets, USAGE_ASSISTANCE_SONIFICATION (USAGE_GAME for games) |
| 91 | fun buzz(kind: BuzzKind) // Vibrator: Tick, Confirm, Reject, Alert(pattern) |
| 92 | fun cue(cue: SoundCue) // play + matching haptic in one call — the common case |
| 93 | } |
| 94 | @Composable fun rememberSounds(): AppSounds // thin, in library/ui next to rememberHaptics() |
| 95 | ``` |
| 96 | Existing `Haptics.confirm()/reject()/tick()` map onto `BuzzKind`; call sites migrate to semantic cues, never raw waveforms (same argument `Haptics.kt` already makes). |
| 97 | |
| 98 | **Settings model:** Android sandboxes give no cross-app shared prefs, so 'global' cannot be one store. Model it as: shared *keys + defaults + settings-row composable* in the library (`Sound & haptics` section: Sound on/off, Vibration on/off, volume), persisted by each app's existing `<App>Prefs` owner (the repo's one-preferences-owner rule). Defaults: sound on, haptics on, except keyboard (sound off, as today) and media players (no SFX). Always honour: ringer mode (silent/vibrate ⇒ no sound, per minesweeper/CallRinger precedent), system haptic-feedback setting (Compose `LocalHapticFeedback` already does), and DND for alert-class cues. Notification-channel sounds remain system-owned per channel (findfamily model) — the helper is for in-app cues only. |
| 99 | |
| 100 | **Assets (owner preference):** real audio files, **generated locally** (offline synth script rendering `.ogg`/`.wav` committed under `library/sound/src/main/res/raw/`), never downloaded, and — new rule — not synthesised at runtime. Voxels `SoundFx` should migrate its generated WAVs to committed assets on next touch. One shared cue set (~12 files, <200 KB total) serves the whole suite; per-game extras (explosion, kart engine) live in that game's `res/raw`. |
| 101 | |
| 102 | **Rollout order:** (1) library/sound + settings row, (2) high-priority in-flight-adjacent (todo complete, hub unlock, chess/solitaire moves, clock timer), (3) commerce/maps/health confirmations, (4) low long-tail as apps are touched. Each step is one app per diff. |
| 103 | |
| 104 | ## Notes / non-candidates |
| 105 | - Music/YouPipe/Uniflix/photos player surfaces: no SFX over media, ever (audio focus). Biometric prompts, system ringtone picker, permission dialogs: system-owned feedback, do not duplicate. Routine refreshes, scrolling, tab switches: silent (existing drag-tick haptics in notes/weather/youpipe are the ceiling). Wear: vibration only. |