Skip to content

feat: Volume independent analyzer on web #12

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ACrazyTown
Copy link

@ACrazyTown ACrazyTown commented Apr 5, 2025

This is an attempt to make the analyser volume-independent on web for parity across desktop and web.

compressed.mp4

Instead of attaching the AnalyserNode directly to the howler gain node, we can check if there's a buffer source node available. If it is, we can "hijack" it and attach our analyser to it directly, allowing us to get audio data straight from the source without any volume changes. If the buffer source node isn't available, we can simply fallback to the old method and attach the analyser to the gain node.

I'm not sure how safe it is to mess with the nodes like this but from my brief testing I haven't encountered any issues. One quirk of this is that now analysers have to be cleaned up with analyser.cleanup() otherwise there might be duplicate event listeners on the sound which may break things. (will be resolved in Funkin' with FunkinCrew/Funkin#4579)

ACrazyTown added a commit to ACrazyTown/Funkin that referenced this pull request Apr 5, 2025
ACrazyTown added a commit to ACrazyTown/Funkin that referenced this pull request Apr 5, 2025
charlesisfeline pushed a commit to charlesmilkjug/Funkin2 that referenced this pull request Apr 5, 2025
ACrazyTown added a commit to ACrazyTown/Funkin that referenced this pull request Apr 30, 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