Skip to content

[ENHANCEMENT + BUGFIX] Improve Freeplay song preview & audio handling#6961

Open
AnimatingLegend wants to merge 1 commit intoFunkinCrew:developfrom
AnimatingLegend:bugfix/freeplay/audio-error
Open

[ENHANCEMENT + BUGFIX] Improve Freeplay song preview & audio handling#6961
AnimatingLegend wants to merge 1 commit intoFunkinCrew:developfrom
AnimatingLegend:bugfix/freeplay/audio-error

Conversation

@AnimatingLegend
Copy link
Copy Markdown
Contributor

@AnimatingLegend AnimatingLegend commented Feb 20, 2026

Linked Issues

Description

Important

THIS PR NEEDS TO BE PROPERLY MAINTAINED!!!

This PR fixes, and improves how the song previews are handled.

Changes:

  • Added a timer to the song preview to prevent audio overlapping
    • Added clearPreviews() inside the timer function so old song requests get cached.
    • [HTML5] Implemented a specific 11 - 13 second fade-out and a 14 second window to prevent audio buffering and overlap.
    • [HTML5] Added a 15 second fall back for the loop timer if the web build fails to get the correct song preview length.
  • Made sure the menu music stops right when the song preview is ready to play.
  • Fixed issue where the song previews don't update after rank animation plays

@github-actions github-actions Bot added status: pending triage Awaiting review. size: huge A huge pull request with more than 500 changes. pr: haxe PR modifies game code. pr: documentation PR modifies documentation or README files. and removed size: huge A huge pull request with more than 500 changes. labels Feb 20, 2026
@AnimatingLegend AnimatingLegend changed the base branch from main to develop February 20, 2026 23:35
@Hundrec Hundrec changed the title [BUGFIX] Prevent song preview from cutting out when navagating to quickly [BUGFIX] Fix song preview stopping completely when navigating Freeplay too quickly Feb 20, 2026
@Hundrec Hundrec added type: minor bug Involves a minor bug or issue. topic: freeplay Related to the operation of the Freeplay menu. and removed pr: documentation PR modifies documentation or README files. labels Feb 20, 2026
@github-actions github-actions Bot added the size: medium A medium pull request with 100 or fewer changes. label Feb 20, 2026
@ComedyLost
Copy link
Copy Markdown
Contributor

Found a bug where if you scroll and change difficulties the preview music won't change

2026-02-20.18-55-52.remuxed.mp4

@AnimatingLegend
Copy link
Copy Markdown
Contributor Author

Found a bug where if you scroll and change difficulties the preview music won't change
2026-02-20.18-55-52.remuxed.mp4

This menu will forever be riddled with bugs 💔

@Huuuuuuuuunk
Copy link
Copy Markdown

would this fix also prevent 2 previews playing at once and the preview playing even after you entered a song?

@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch 3 times, most recently from b95a38e to 955e246 Compare February 28, 2026 21:55
@AnimatingLegend
Copy link
Copy Markdown
Contributor Author

AnimatingLegend commented Feb 28, 2026

would this fix also prevent 2 previews playing at once and the preview playing even after you entered a song?

It should!

@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from 955e246 to e518b83 Compare March 1, 2026 03:40
@Huuuuuuuuunk
Copy link
Copy Markdown

another thing that happened to me was that i sat idle for way too long and it stopped playing

@AnimatingLegend
Copy link
Copy Markdown
Contributor Author

another thing that happened to me was that i sat idle for way too long and it stopped playing

Ik why that happens. its because the song previews aren't pre-cached on web. so the audio just randomly cuts out after its done instead of playing again. thank you for bringing this to my attention!

@github-actions github-actions Bot added size: large A large pull request with more than 100 changes. and removed size: medium A medium pull request with 100 or fewer changes. labels Mar 2, 2026
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from 17377e7 to db74b3a Compare March 2, 2026 03:12
@github-actions github-actions Bot added size: medium A medium pull request with 100 or fewer changes. and removed size: large A large pull request with more than 100 changes. labels Mar 2, 2026
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch 3 times, most recently from cfd8b8a to 81a9ea2 Compare March 2, 2026 03:19
@Huuuuuuuuunk
Copy link
Copy Markdown

One more thing, when you unfocus the game, and then go back to the game, the inst preview restarts

@AnimatingLegend
Copy link
Copy Markdown
Contributor Author

AnimatingLegend commented Mar 5, 2026

One more thing, when you unfocus the game, and then go back to the game, the inst preview restarts

I'm pretty sure thats intentional... If the song preview continues playing when unfocused, it might cause major audio issues in the long run.

@Hundrec
Copy link
Copy Markdown
Member

Hundrec commented Mar 6, 2026

I'll confirm that unfocusing doesn't restart the song preview
If it does in this PR, you should probably revert to the original behavior

@AnimatingLegend
Copy link
Copy Markdown
Contributor Author

@Huuuuuuuuunk after further examination of the bug you recently mentioned, i don't think that can be fixed. I've tried everything that i can, but it's just HTML5 in general. :/

@Huuuuuuuuunk
Copy link
Copy Markdown

I'll confirm that unfocusing doesn't restart the song preview If it does in this PR, you should probably revert to the original behavior

For me, it did on web 0.8.3 (itch.io)

@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch 8 times, most recently from 96baddf to 6c089cb Compare March 16, 2026 22:03
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from 6c089cb to b34659d Compare March 22, 2026 04:40
@AnimatingLegend AnimatingLegend changed the base branch from develop to dummy/develop-v0.8.3 March 23, 2026 01:11
@AnimatingLegend AnimatingLegend changed the title [BUGFIX / ENHANCEMENT] Improve Freeplay song preview & audio handling [ENHANCEMENT + BUGFIX] Improve Freeplay song preview & audio handling Mar 23, 2026
@AnimatingLegend AnimatingLegend changed the base branch from dummy/develop-v0.8.3 to develop March 25, 2026 21:20
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch 3 times, most recently from d89d9b4 to dc38c60 Compare April 1, 2026 23:22
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch 3 times, most recently from 1d96b73 to 6becc88 Compare April 5, 2026 02:38
@Hundrec Hundrec force-pushed the develop branch 2 times, most recently from 2abd802 to ec59410 Compare April 6, 2026 10:18
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from 6becc88 to fc61e9d Compare April 6, 2026 20:08
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from fc61e9d to 72f3a5d Compare April 26, 2026 04:57
Closes FunkinCrew#6932, FunkinCrew#7039, FunkinCrew#6432 & FunkinCrew#7157

- Added a timer to the song preview to prevent audio overlapping.
     * Added `clearPreviews()` inside the timer function so old song requests get cached.
     * [HTML5] Implemented a specific 10 - 12 second fade-out and a 14 second window to prevent audio buffering and overlap.
     * [HTML5] Added a 15 second fallback for the loop timer if the web build fails to get the correct song preview length.
- Made sure the menu music stops right when the song.
- Fixed issue where the song previews don't update after rank animation plays.
@AnimatingLegend AnimatingLegend force-pushed the bugfix/freeplay/audio-error branch from 76639e3 to bbdce06 Compare May 3, 2026 04:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr: haxe PR modifies game code. size: medium A medium pull request with 100 or fewer changes. status: pending triage Awaiting review. topic: freeplay Related to the operation of the Freeplay menu. type: minor bug Involves a minor bug or issue.

Development

Successfully merging this pull request may close these issues.

Bug Report: Instrumental previews don't fade out on web Bug Report: Navigating around Freeplay quickly can cause song preview to not start

4 participants