flutter_soloud icon indicating copy to clipboard operation
flutter_soloud copied to clipboard

fix: SoLoudFileLoadFailedException:... (on the C++ side) with some specific files

Open mokus opened this issue 8 months ago • 3 comments

When loading some specific mp3 files the engine throws SoLoudFileLoadFailedException: File found, but could not be loaded! Could be a permission error or the file is corrupted. (on the C++ side).

Example file: https://drive.google.com/file/d/1jLEHW0h-5My1hVUqGcQXYwG-I46vQKM7/view?usp=sharing (Can't attach to the report as mp3 isn't allowed)

Steps to reproduce

  1. Load file with loadAsset() or loadFile()
  2. An exception is being thrown

Expected Behavior

The file should get loaded as it's a valid mp3

mokus avatar Apr 02 '25 15:04 mokus

Hi @mokus,

I tried your audio and I got the same result. It can be played by Vlc, but the C lib used in flutter_soloud cannot decode it!

I am afraid that we should wait for a fix in dr_mp3.h.

Meanwhile, you can use ffmpeg to rewrite the mp3 like this:

ffmpeg -i i_lost_at_the_game_again.mp3 -b:a 128k i_lost_at_the_game_again-B.mp3

I tried the new audio and it works.

alnitak avatar Apr 03 '25 08:04 alnitak

@alnitak Thank you for such a quick reply. Would converting to ogg be a better option?

mokus avatar Apr 03 '25 08:04 mokus

Would converting to ogg be a better option?

ogg is usually better than mp3, for size and quality at the same bitrate. But you need to try for your use case. I bet on ogg format :)

update: here an interesting reading https://www.gumlet.com/learn/ogg-vs-mp3/

alnitak avatar Apr 03 '25 08:04 alnitak

I've been running into this with some .wav files. I'll report what I learn here.

Taormina avatar May 28 '25 23:05 Taormina

It turned out that MacOS was lying about some files being .wav when they were actually aiff, so just converted those to be real .wav files.

Taormina avatar May 29 '25 03:05 Taormina