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

Found a WAV file that doesn't play #3

Open
Dimev opened this issue Dec 9, 2020 · 9 comments
Open

Found a WAV file that doesn't play #3

Dimev opened this issue Dec 9, 2020 · 9 comments

Comments

@Dimev
Copy link

Dimev commented Dec 9, 2020

As the title suggest: I found a wav file that doesn't play.
I can't send it as it's too large, but the data starts at ~byte 700, and it contains artist names + a junk chunk
changing the loop to go to that causes it to make weird glitchy sound.
I don't really know how to solve this one sadly, but it works fine when imported with the normal audio importer: https://github.com/godotengine/godot/blob/master/editor/import/resource_importer_wav.cpp

Example file: https://mega.nz/file/tFdXlSiL#YWdCsuFSaRtWa8felZX1FWsVer247oAjGyEXPFV34Yk

@Gianclgar
Copy link
Owner

Hi, could you try to send/post the file via a third party service? I recommend https://tmp.ninja/ since it has a 10gb limit.

Looks like an error in the parsing, since it expects the wav files to have the same structure. This could help to adapt the parsing to different pre-data chunk sizes, so it will be very helpful

@Dimev
Copy link
Author

Dimev commented May 14, 2021

Ah right I have mega, l'll share it via there
I do think it has to do with the header. I also tried porting the built-in parser to gdscript but that's really slow

@Dimev
Copy link
Author

Dimev commented May 14, 2021

It seems to sometimes happen with music downloaded as wav with youtubedl

re-exporting it with audacity fixes the issue

@pixelriot
Copy link

I've done some testing, and it seems as if wav files with 24 bps don't play properly, while the ones with 16 bps have no problem.
Maybe that helps in finding the bug.
I will continue my research.

@Gianclgar
Copy link
Owner

Gianclgar commented Jul 9, 2021

I've done some testing, and it seems as if wav files with 24 bps don't play properly, while the ones with 16 bps have no problem.
Maybe that helps in finding the bug.
I will continue my research.

Makes sense since the bitrate is not handled in the current version, just printed out. See lines 118 and 119. I added a "TODO" in the comments

Also, as mentioned in #7 , the format code "3" , which seems to be for 24bit audio is not handled yet.

@pixelriot
Copy link

When loading the 24bps wav file directly into a Godot AudioPlayer node everything plays fine, although the stream in GD source code seems to not handle format code "3": https://github.com/godotengine/godot/blob/master/scene/resources/audio_stream_sample.cpp#L368

@Gianclgar
Copy link
Owner

Gianclgar commented Jul 9, 2021

Yup, I've been checking the Godot ResourceImporter code, and it automatically converts bitrates greater than 16bit to 16bit. See lines 289 and below https://github.com/godotengine/godot/blob/a02620f3a5f3b94c68dfbe18874b34ac1c32374a/editor/import/resource_importer_wav.cpp

The file mentioned in #7 is 32bit and when imported with the built-in resource importer it's converted to 16bit.

I assume they did not cover this since they expected users to always use the built-in resource importer

@Gianclgar
Copy link
Owner

This might have been fixed by #13 . Awaiting confirmation!

@pixelriot
Copy link

Works like a charm. Nearly my whole wav-library can be played back now. Thanks a lot.

However, I found some that don't play. Somehow, the data-part of "those4bytes" seems empty.
https://drive.proton.me/urls/FDQ71VN5WC#zIZqoIAFgZ1n

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

No branches or pull requests

3 participants