feat(notifications): scale completion sound speed with task length#3026
Merged
Conversation
Add an opt-in "Scale sound speed with task length" toggle to Settings → Notifications. When enabled, the completion sound's playback rate reflects how long the just-completed turn took: a quick task (<30s) plays up to 3x faster (higher pitch), the 2-4 min "normal" band plays at normal speed, and a long task (>=30min) plays up to 3x slower (lower pitch), with smooth log-interpolation across the ramps. Off by default, so existing behavior is unchanged. Generated-By: PostHog Code Task-Id: e2191f70-e37c-4f84-b59f-54d458e496fd
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
|
Reviews (1): Last reviewed commit: "feat(notifications): scale completion so..." | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Format the it.each block added by the code-review suggestions to satisfy biome ci (collapse the callback onto the matcher line, wrap the long tuple element). Generated-By: PostHog Code Task-Id: e2191f70-e37c-4f84-b59f-54d458e496fd
The cloud turn_complete path now forwards a per-turn durationMs (undefined when no prompt-start was recorded, as in this harness). Update the toHaveBeenCalledWith assertion to match the new arity. Generated-By: PostHog Code Task-Id: e2191f70-e37c-4f84-b59f-54d458e496fd
Gilbert09
added a commit
that referenced
this pull request
Jul 1, 2026
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
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.
Summary
Adds an opt-in "Scale sound speed with task length" toggle to Settings → Notifications. When enabled, the completion sound's playback rate reflects how long the just-completed turn took:
[1/3, 3]Off by default, so existing behavior is unchanged unless the user turns it on. It uses
HTMLAudioElement.playbackRate, so faster also means higher-pitched and slower means lower-pitched.How it works
playbackRateForTaskDuration(durationMs)helper insounds.ts;playCompletionSoundgains an optionalplaybackRateparam.sessionServicefromacpMsg.ts - session.promptStartedAt(Immer keeps the pre-update snapshot, so the start time is still readable), plumbed throughnotifyPromptComplete→NotificationBus.notify→playCompletionSound.scaleSoundWithTaskLengthsetting added to the settings store, theNotificationSettingscontract, the desktop settings provider, and the Notifications settings UI (shown only when a sound is selected; included in "Reset to defaults").Tests
sounds.test.ts: parametrized coverage of the duration→rate mapping across anchor/boundary points.notifications.test.ts: asserts the scaled rate is applied when the toggle is on with a duration, and1when off or when no duration is available.Created with PostHog Code