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

Fix WAV pop sound after seek with unknown chunk in header #183

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

MarkKremer
Copy link
Contributor

@MarkKremer MarkKremer commented Sep 6, 2024

Resolves #182

The pop sound was caused by an error in the header size calculation. When a WAV file contained a unknown chunk, first the chunk type (4 bytes) is red, then the size (4 bytes) and after that is the chunk data. The 4 bytes indicating the size weren't added to the total header size. When seeking to the beginning of the sample data, it would seek to a position in the header before the data. The header was then parsed as sample data, which caused the pop.

Test file:
pop.zip
Can be reproduced with the speedy-player by changing the decoded file type to WAV.

When an unknown chunk is reached, the bytes that hold the chunk size weren't added to the total header size. After a seek to the start of the file, the seek position would end up before the sample data, interpreting part of the header as samples.
@MarkKremer MarkKremer merged commit 376f6c5 into main Sep 6, 2024
1 check passed
@MarkKremer MarkKremer deleted the fix-wav-pop-sound-with-unknown-chunk branch September 6, 2024 20:42
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.

Popping sound
2 participants