Skip to content

feat(audio): add audio fading capabilities with configurable duration (in settings) - #438

Open
httperry wants to merge 101 commits into
sozercan:mainfrom
httperry:feature/audio-fade
Open

feat(audio): add audio fading capabilities with configurable duration (in settings)#438
httperry wants to merge 101 commits into
sozercan:mainfrom
httperry:feature/audio-fade

Conversation

@httperry

@httperry httperry commented Aug 13, 2026

Copy link
Copy Markdown

Description

Adds smooth, natural audio fade-in and fade-out functionality on play, pause, and track resume. Instead of abrupt audio cuts or linear volume steps that feel sudden to human hearing, volume changes are interpolated over an Equal-Power sine/cosine curve matching Apple Music and Spotify player standards. Also adds a configurable fade duration control under Music Settings.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📚 Documentation update
  • 🎨 UI/UX improvement
  • ♻️ Refactoring (no functional changes)
  • 🧪 Test update
  • 🔧 Build/CI configuration

Related Issues

N/A

Changes Made

  • Equal-Power Volume Curve Math: Implemented logarithmic sine/cosine gain ramps ($V = \sin(p \cdot \frac{\pi}{2})$ on fade-in, $V = \text{startVol} \cdot \cos(p \cdot \frac{\pi}{2})$ on fade-out) in SingletonPlayerWebView+PlaybackControls to align with logarithmic human auditory perception.
  • Configurable Fade Duration: Added an audio fading toggle and customizable fade duration slider (0.3s–2.5s, default 0.5s) in SettingsManager and integrated seamlessly into MusicSettingsView.
  • Re-Entry & Autoplay Oscillation Prevention: Added isFadeOutInProgress state guard in MiniPlayerWebView to prevent rapid play/pause toggle glitches, and guarded enforceVolumeNow() against active fade intervals.
  • Unit Testing: Added test coverage in AudioFaderServiceTests covering fade progression calculations, duration clamping, and coordinator lifecycle.

Usage

Enable the feature in settings if not already enabled, try pausing/playing the music

Testing

  • Unit tests pass (xcodebuild test -only-testing:KasetTests / swift test)
  • Manual testing performed
  • UI tested on macOS 26+

Checklist

  • My code follows the project's style guidelines
  • I have run swiftlint --strict && swiftformat .
  • I have added tests that prove my fix/feature works
  • New and existing unit tests pass locally
  • I have updated documentation if needed
  • I have checked for any performance implications
  • My changes generate no new warnings

Screenshots

N/A

Additional Notes

  • All changes are self-contained within playback controls and user settings.
  • Preserves native macOS keyboard shortcuts and Apple Music media control conventions.

…MainWindow and AudioFadingSettingsSection into MusicSettingsView
Copilot AI review requested due to automatic review settings August 18, 2026 16:33
@httperry
httperry force-pushed the feature/audio-fade branch from 54d0839 to 97796f0 Compare August 18, 2026 16:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 11:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 14:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 22, 2026 14:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 23, 2026 01:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 23, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 23, 2026 03:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants