Skip to content

add: implement audio mixing functionality with dynamic layer management#126

Merged
1Lucas1apk merged 2 commits into
v3from
dev
Dec 10, 2025
Merged

add: implement audio mixing functionality with dynamic layer management#126
1Lucas1apk merged 2 commits into
v3from
dev

Conversation

@1Lucas1apk

Copy link
Copy Markdown
Member

Changes

  • Added full audio mixing system with dynamic layer management.
  • Introduced new REST endpoints:
    • POST /sessions/{sessionId}/players/{guildId}/mix – create a new mix layer.
    • GET /sessions/{sessionId}/players/{guildId}/mix – list all mix layers.
    • PATCH /sessions/{sessionId}/players/{guildId}/mix/{mixId} – update mix volume.
    • DELETE /sessions/{sessionId}/players/{guildId}/mix/{mixId} – remove a mix layer.
  • Implemented AudioMixer class with:
    • Independent PCM mixing per layer
    • Volume scaling
    • Automatic layer cleanup
    • Finish detection via empty reads
    • Error handling and emissions (mixStarted, mixEnded, mixError)
  • Added mix configuration under mix { enabled, defaultVolume, maxLayersMix, autoCleanup }.
  • Added cluster-aware mix command handling through playerManager.
  • Player now initializes AudioMixer and emits gateway events:
    • MixStartedEvent
    • MixEndedEvent
  • Mixing is now integrated into playback pipeline through streamProcessor.
  • Added version bump to 3.3.0.

Why

This adds native support for layered audio playback — allowing bots to play sound effects, transitions, stingers, background loops and dynamic overlays at the same time as the main track.
The system is fully dynamic, cluster-safe, and supports real-time volume adjustments and automatic cleanup.

Checkmarks

  • The modified endpoints have been tested.
  • Used the same indentation as the rest of the project.
  • Still compatible with Lavalink clients.

Additional information

  • Mixing is done at PCM level for maximum performance.
  • Layer streaming is non-blocking and isolated.
  • Default config allows 5 simultaneous layers, adjustable via config.default.js.

@1Lucas1apk 1Lucas1apk merged commit a95a7e3 into v3 Dec 10, 2025
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