feat(mobile): scale completion sound speed with task length#3050
Open
Gilbert09 wants to merge 3 commits into
Open
feat(mobile): scale completion sound speed with task length#3050Gilbert09 wants to merge 3 commits into
Gilbert09 wants to merge 3 commits into
Conversation
Ports the desktop feature from #3026 to the mobile app: the task-completion sound now plays at a variable rate based on how long the turn ran — quick tasks ring fast (higher pitch), long tasks drag slow (lower pitch). A new "Scale sound speed with task length" setting gates the behavior, defaulting off. - Add `playbackRateForTaskDuration` (verbatim from desktop) mapping duration to a playback rate, and thread an optional `playbackRate` through `playCompletionSound`, setting `rate`/`shouldCorrectPitch: false` on expo-av. - Add the `scaleSoundWithTaskLength` preference (persisted, default off). - Track prompt start time on the session and compute the rate at the ping sites. - Add the settings toggle, shown only when a completion sound is enabled. Generated-By: PostHog Code Task-Id: dc58b11c-b3fc-4275-8102-9bffed29d638
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(mobile): scale completion sound spe..." | Re-trigger Greptile |
…mock The store imports playbackRateForTaskDuration from ../utils/playbackRate, not ../utils/sounds, so stubbing it in the sounds mock had no effect. The function is pure and dependency-free, so let the real implementation run rather than add a redundant mock. Generated-By: PostHog Code Task-Id: dc58b11c-b3fc-4275-8102-9bffed29d638
…peed Generated-By: PostHog Code Task-Id: 7393b760-09b1-49d1-b90c-695eca0e50fa
tatoalo
approved these changes
Jul 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the desktop feature from #3026 to the mobile app (
apps/mobile, React Native / Expo).What this does
When a turn finishes and the completion sound plays, it now plays at a variable playback rate based on how long the task ran: quick tasks ring fast (higher pitch), long tasks drag slow (lower pitch). A new settings toggle, "Scale sound speed with task length", gates the behavior and defaults off.
Changes
features/tasks/utils/playbackRate.ts(new) —playbackRateForTaskDuration(durationMs), ported verbatim from desktop. Maps duration to a rate:<=30s → 3x, the 2–4min "normal" band →1x,>=30min → 1/3x, with smooth log-interpolation across the two ramps.features/tasks/utils/sounds.ts—playCompletionSoundtakes an optionalplaybackRate; setsrateandshouldCorrectPitch: falseon the expo-av player so pitch shifts with speed (matching desktop). Dropped the now-unusedplayMeepSoundalias.features/preferences/stores/preferencesStore.ts— added thescaleSoundWithTaskLengthpreference (defaultfalse) with a setter, persisted alongside the other completion-sound prefs.features/tasks/stores/taskSessionStore.ts— trackpromptStartedAton the session when a prompt starts on this device; at the ping sites, when the setting is enabled and a start time is known, play atplaybackRateForTaskDuration(elapsed), otherwise at rate 1.app/settings/index.tsx— added the toggle row, shown only when completion sounds are enabled.Tests
playbackRateForTaskDurationmirroring the desktop cases (<=30s → 3, normal band →1,>=30min → 1/3) plus a monotonicity check.