Cannot create FMOD::Sound instance for clip "" (FMOD error: Unsupported file or audio format. )

Hello, I'm getting the error "Cannot create FMOD::Sound instance for clip "" (FMOD error: Unsupported file or audio format. )" on some mp3-files.

Here's one file that doesn't work: https://easyupload.io/0rye3j
The mp3 is playable in VLC and browser, (everywhere else)

audioClip = ((DownloadHandlerAudioClip)uwr.downloadHandler).audioClip;
Is supposed to return "Returns the downloaded AudioClip, or null. (Read Only)", it returns an invalid audioclip with length 0 instead of null. So I'm guessing this is a bug.

public IEnumerator LoadSingleSong(string songPath, Action<AudioClip> callback)
    {
        AudioClip audioClip = null;
        using (var uwr = UnityWebRequestMultimedia.GetAudioClip("file://" + songPath, AudioType.MPEG))
        {
            ((DownloadHandlerAudioClip)uwr.downloadHandler).streamAudio = false;
            ((DownloadHandlerAudioClip)uwr.downloadHandler).compressed = false;

            yield return uwr.SendWebRequest();

            if (uwr.result != UnityWebRequest.Result.InProgress && uwr.result != UnityWebRequest.Result.Success)
            {
                Debug.LogError(uwr.error);
                yield break;
            }

            yield return new WaitUntil(() => uwr.downloadHandler.isDone);

            audioClip = ((DownloadHandlerAudioClip)uwr.downloadHandler).audioClip; <---------- ERROR HERE
            if (audioClip == null)
            {
                Debug.LogError("Audioclip is null.");
                yield break;
            }

            if (uwr.error != null)
            {
                Debug.Log("Encountered error.");
                yield break;
            }

            if (audioClip.length < 5.0f)
            {
                Debug.Log("Song is too short.");
                yield break;
            }

            audioClip.name = Path.GetFileName(songPath);
            Debug.Log($"We've loaded custom song with name: {audioClip.name} and type: {audioClip.loadType} and the length: {audioClip.length}");
        }

        callback(audioClip);
    }

Using Unity 2020.3.35f1

.

The link you shared is not an MP3 but an MP4. FMOD doesn’t support MP4, only MP3

1 Like

Wow, yeah, you're right. Thank you!
The youtube-to-mp3 converter is wrong then.
I'm sorry, I should've checked that.

1 Like

[quote=“The_Island”, post:3, topic: 891149]
The link you shared is not an MP3 but an MP4. FMOD doesn’t support MP4, only MP3
[/quote]

Still I think what @fredholmsimon pointed out is right: Unity API here is supposed to return null and not an inconsistent audio clip. At least this is what the Documentation states. I am on a similar problem where I load per purpose load corrupt audio data and need to check if the Engine was able to load them or not.

1 Like