Skip to content

Comments

feat: add crossfade with audio enhancements#78

Open
squirmen wants to merge 9 commits intoplaywora:mainfrom
squirmen:feature/crossfade
Open

feat: add crossfade with audio enhancements#78
squirmen wants to merge 9 commits intoplaywora:mainfrom
squirmen:feature/crossfade

Conversation

@squirmen
Copy link
Contributor

@squirmen squirmen commented Sep 8, 2025

Summary

  • Implements smooth crossfade between tracks with configurable duration (0-12 seconds)
  • Adds optional audio enhancements: volume normalization and silence detection
  • Fixes volume change bug that was restarting tracks

Changes

Core Crossfade Implementation

  • New CrossfadeController class manages dual-voice architecture for gapless playback
  • Smooth volume transitions during crossfade with proper overlap timing
  • Preloads next track for instant transitions
  • Maintains playback position through UI updates

Audio Enhancements (Optional)

  • Volume Normalization: Analyzes tracks to maintain consistent volume levels (±50% max adjustment)
  • Silence Detection: Intelligently skips silence at beginning/end of tracks (max 3s trim)
  • Both features disabled by default for safety, can be enabled via "Audio Enhancement" toggle

Bug Fixes

  • Fixed track restarting when changing volume/mute (removed from useEffect dependencies)
  • Fixed TypeScript compilation errors in error handlers
  • Fixed hydration mismatch in navbar theme icon
  • Properly maintains seek position during crossfade transitions

Code Quality

  • Full TypeScript support with proper type definitions
  • Comprehensive error handling
  • Clean separation of concerns
  • No debug code or console.logs in production paths

…rack restart from the beginning. Added crossfade functionality with dual-voice crossfading
…-in-wora

Fix crossfade timing to avoid abrupt track cutoff
- Fixed crossfade timing so both songs play simultaneously during fade
- Current track fades out while next track fades in over crossfade duration
- UI switches to next track only after crossfade completes
- Maintains playback position to prevent restart when UI updates
- Cleaned up console.log statements and verbose comments
- Added mounted check to prevent hydration errors
- Shows default icon until client-side mounting completes
- Fixes console warning about hydration mismatch
…ection

- Implemented gapless playback with intelligent track preloading (10s ahead)
- Added volume normalization to balance track levels (±50% safe adjustment)
- Added conservative silence detection to trim dead air (max 3s)
- Combined features into single "Audio Enhancement" toggle
- Clean UI with adjustment icon matching app design language
- All features disabled by default for safety
- Efficient caching system for audio analysis
- Works seamlessly with crossfade and existing playback features
- Removed volume and isMuted from audio loading useEffect dependencies
- Added separate useEffect to handle volume changes without reloading
- Used refs to track current volume values without triggering re-renders
- Volume changes now update the audio element directly without restarting playback
- Fix TypeScript errors in error event handlers by adding proper type assertions
- Remove .idea folder from git tracking
- Add .idea to .gitignore to prevent future tracking
- Ensure clean compilation with no type errors
- Replace HTML5 audio manipulation with Web Audio API implementation
- Add dual-voice architecture with proper gain nodes and audio graph
- Implement LUFS normalization at -16 dB audiophile standard
- Add multiple crossfade curves (S-curve, equal power, logarithmic, exponential)
- Integrate native audio analysis via Electron IPC with FFmpeg
- Add beat detection and BPM analysis for future beat-matching
- Implement advanced silence detection for gapless playback
- Add true peak limiting with dynamics compression
- Fix race conditions and memory leaks in crossfade logic
- Enable 10-second preload for seamless transitions

This is a major upgrade from the basic crossfade implementation,
providing professional-grade audio mixing with proper Web Audio API
integration for true simultaneous playback and mixing of tracks.
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.

1 participant