Hi, anyone know of an mp3 encoder that won’t cause this to happen in JUCE:
if (bitrateIndex == 0)
jassertfalse; // This means the file is using "free format". Apparently very few decoders
// support this mode, and this one certainly doesn't handle it correctly!
frameSize = 0;
I’ve tried 4 now, even exporting mp3 from Live but keep hitting this issue.
Also, I think the comment “Apparently very few decoders support this mode” may no longer be accurate as most encoders seem to generate these type of files. Perhaps it’s time up update the MP3 decoder in JUCE to support this.
Solution for Windows… needs precompiled LAME encoder:
auto TEMP = File::getSpecialLocation(File::SpecialLocationType::tempDirectory).getFullPathName() + File::getSeparatorString();
auto LAME_EXE = File(TEMP + "lame.exe");
auto data = BinaryData::getNamedResource(String("lame.exe").replace(".", "_").replace("-", "").toRawUTF8(), size);
if (size > 0)
// Add metadata...
writer.reset(format->createWriterFor(new FileOutputStream(outFile), 44100, 2, 16, WavMetadata, 23)); // CBR 320 Kbps
if (writer != nullptr)
writer->writeFromAudioSampleBuffer(buffer, 0, buffer.getNumSamples());
In this example I have added lame.exe to the resources. It is extracted and copied to the system temporary directory. You might want to install lame in a known directory and call the executable directly from there.
Hi, is there a solution for Mac?
Also, can the JUCE devs comment on why the mp3 decoder supplied with JUCE is so limited? thx
Just do the same thing but using the mac version of lame.