-
-
Notifications
You must be signed in to change notification settings - Fork 235
fix(sound): fix audio feedback hijacking macOS media controls #724
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(sound): fix audio feedback hijacking macOS media controls #724
Conversation
24151c8 to
593ca24
Compare
|
I found an issue that when you leave the Whisper app running for a long time, eventually the audio system falls down. The app still runs just fine when you hit the shortcut key to record and finish the recording, but it doesn't play any audio out loud until you close and reopen the app. I am working to debug this before I request a review again. |
|
I've worked out the few bugs that I have been able to find. I don't have a Windows machine to test on or Linux, but I think that this is ready to go. Issue I ran into was that the WebAudio library I was using would somehow lose its connections to the output speakers over time so it would work for a couple hours and as soon as you put your computer to sleep or woke it up it would not be able to play any more sound out everything still runs is fine it would just not output sound. This is fixed now because I just create that web audio context each time before playing and when finished playing the sounds. |
|
^ This is a really persistent problem that makes me unable to use whispering. is there a known temp fix or can a fix be pushed for this? |
|
I have been running with this change locally on my machine for weeks and it works flawlessly to Still plays the start and end recording sound. And for an extra bonus, I added this feature, which actually pauses whatever other music is playing and then automatically plays again once it's complete. Check it out: #911 I am just waiting for the maintainers to review this PR and merge it in. |
Summary
This PR fixes the issue where Whispering's audio feedback sounds hijack macOS media controls. Previously, when Whispering played completion sounds, pressing the play/pause button on your keyboard would repeat the Whispering sound instead of controlling your original media (Spotify, Apple Music, etc.).
Type of Change
feat: New featurefix: Bug fixdocs: Documentation updaterefactor: Code refactoring (no functional changes)perf: Performance improvementtest: Test additions or changeschore: Maintenance tasksstyle: Code style changesRelated Issue
Closes #722
Changes Made
Problem
When Whispering plays audio feedback sounds (like the "ta-da" completion sound), it hijacks the system's media controls. This means pressing the play/pause button on your keyboard repeats the Whispering sound instead of controlling your original media (Spotify, Apple Music, etc.).
Root Cause
HTML5
<audio>elements automatically register with macOS's media control system when they play, making the web app the "now playing" application.Solution
Replaced HTML5 audio elements with Web Audio API, which plays audio without interfering with media controls.
Before:
After:
Implementation
src/lib/services/sound/web-audio.ts)Testing
Desktop App Testing
General Testing
Feature-Specific Testing
Verified that:
Checklist
typeinstead ofinterfacein TypeScriptScreenshots/Recordings
No UI changes - this is a backend audio implementation change that fixes media control hijacking without affecting the user interface.
Additional Notes
Benefits
Files Changed
apps/whispering/src/lib/services/sound/web-audio.ts- New Web Audio API implementationapps/whispering/src/lib/services/sound/desktop.ts- Updated to use Web Audio APIdocs/specs/20250121T143000-macos-media-control-integration.md- Updated specification