Files with Bad Metadata Asserting Audio File Reader

I’m getting an error in this line when the Audio Format Reader is trying to build out all the metadata information:

values.set (WavAudioFormat::bwavOriginator, String::fromUTF8 (originator, sizeof (originator)));

My code looks like this:

std::unique_ptrjuce::AudioFormatReader reader(formatManager.createReaderFor(myFile));

It works great on most files, but any files with curropt metadata it asserts. Is there anyway to skip over that metadata or somehow not assert?!

Asserts should only interrupt your program while you are in the debugger. While this can be annoying while debugging, it doesn’t impact your shipping code, unless the assert results in a subsequent crash. One of the great things about JUCE is that you have the source code, so if this is too disruptive during development, you can just go in and comment out the assert while you are in development.

The problem here is that the jassert happens in the Juce String code, and commenting out the jassert from that is potentially a quite disruptive change as so many things in Juce use the String class. Detecting the corrupt/incompatible metadata should IMHO already happen in the Wav file parser itself.

2 Likes

Just added an answer in the other thread where you asked: