libnyquist
libnyquist copied to clipboard
shouldn't rely on file extension
libnyquist decodes "myfile.mp3" just fine.
But if I rename it to "myfile.data", it gives some kind of format error.
Shouldn't the library read the header from the beginning of the file, instead of relying on the file extension?
if you need to work around it, you can read in the file yourself and pass only the raw encoded audio to libnyquist like this:
vector<uint8_t> encoded_audio;
...//read in idk how
shared_ptr<nqr::AudioData> file_data = make_shared<nqr::AudioData>();
nqr::NyquistIO loader;
loader.Load(file_data.get(), encoded_audio);
then it should properly recognize the file format, at least I think so
@4321ba Unfortunately it does not!
@bart9h You're definitely right here, that's what the library should do :) I started incubating this feature a long time ago on this branch, but never had time to test and merge it. Happy to accept and PRs to get it working properly.
hmm does it not? it worked for me though and like I don't know the codebase but at https://github.com/ddiakopoulos/libnyquist/blob/master/src/Common.cpp#L64 it really seems like it guesses the file type based on magic numbers, properly this commit: https://github.com/ddiakopoulos/libnyquist/commit/dafe5969aee9be47b96c88903f1d46d5341833b7
@4321ba lol, alright my memory was clearly very wrong and I didn't bother to look at the code. Thanks for checking :)