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

WAV loader is not dealing with possible 'JUNK' chunk and therefore might fail in file loading. #23

Open
MaGetzUb opened this issue Aug 22, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@MaGetzUb
Copy link
Collaborator

Sometimes WAV encoders might add an additional 'JUNK' chunk into .wav files to ensure byte alignment with the pcm data (so I'd think at least). 'JUNK' chunk might appear before 'fmt ' chunk, and therefore some action should be taken, to prevent the decoder from failing.

My suggestion is to read 4 bytes, compare it to 'JUNK' first, if it exist then read the next four bytes to acquire the chunk size, and then skip the number chunk size bytes, and then proceed to deal with 'fmt ' chunk. If the 'JUNK' chunk didn't exist, seek back last 4bytes, and then proceed read and to deal with 'fmt ' chunk.

@MaGetzUb MaGetzUb added the bug Something isn't working label Aug 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant