Skip to content
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

Resampler: Fix crackles when looping the audio #2762

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Apr 3, 2022

I "only" needed 4 hours to come up with this solution. Well, after debugging for 4 hours I finally understood how our resampler works. I was also able to simplify the code alot until I discovered where the crackles are coming from: The wrapped_decoder is not looping.

Refactoring the resampler to get it merged with the decoder will take a while, so I provide here a workaround to get rid of the crackles for now.


For a smooth looping without gaps the wrapped_decoder must be able to loop.

The solution is more of a hack / short-term solution:
All loop-related methods were forwarded to the wrapped_decoder

The better, more complex solution is refactoring the code by merging Decoder+Resampler
to give more control about the decoding process without all this ugly forwarding.

Fix #2666

For a smooth looping without gaps the wrapped_decoder must be able to loop.

The solution is more of a hack / short-term solution:
All loop-related methods were forwarded to the wrapped_decoder

The better, more complex solution is refactoring the code by merging Decoder+Resampler
to give more control about the decoding process without all this ugly forwarding.

Fix EasyRPG#2666
@Ghabry Ghabry added the Audio label Apr 3, 2022
@Ghabry Ghabry added this to the 0.7.1 milestone Apr 3, 2022
@Ghabry
Copy link
Member Author

Ghabry commented Apr 5, 2022

The result in emscripten is better than before but the "blop" sounds are still kinda noticable.

Could be also a problem of the shity Web Audio API. This must be revisited when the audio stuff is refactored. Still better than before with this PR.

Copy link
Member

@carstene1ns carstene1ns left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@carstene1ns carstene1ns merged commit 87d422a into EasyRPG:master Apr 10, 2022
@Ghabry Ghabry deleted the audio/resampler branch May 29, 2022 16:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Yume 2kki: Certain music crackles/pops audibly when looping
3 participants