Loading MP3 files causes sharp 16khz low pass cut

(Example image, top is original MP3 and bottom is Wavwriter, output at 96khz to remove resampling artifacts. Note that occasionally it lets through the blocked frequencies, but at reduced quality, almost like it’s been reencoded, and some audio files don’t even get that.)

Code used

Please don’t criticize my code too hard, I’ve not programmed in C before, but i needed a quick way to test this :grin:

#include "inc/fmod.h"
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
int main() {
    
    FMOD_SYSTEM  *system;
    FMOD_SOUND   *sound;
    FMOD_CHANNEL *channel = 0;
    FMOD_RESULT   result;
    
    FMOD_ADVANCEDSETTINGS settings;
    memset(&settings, 0, sizeof(settings));
    settings.cbSize = sizeof(settings);

    settings.resamplerMethod = FMOD_DSP_RESAMPLER_SPLINE;
    

    result = FMOD_System_Create(&system, 0x20231);
    printf("%d\n",result);
    

    FMOD_SPEAKERMODE  speakermode;
    int               numrawspeakers;
    FMOD_System_GetSoftwareFormat(system, (int *)0, &speakermode, &numrawspeakers);
    FMOD_System_SetSoftwareFormat(system, 48000*2, speakermode, numrawspeakers);

    FMOD_System_SetOutput(system, FMOD_OUTPUTTYPE_WAVWRITER);

    FMOD_System_SetAdvancedSettings(system, &settings);
    

    result = FMOD_System_Init(system, 2, 0, 0);
    printf("%d\n",result);
    

    result = FMOD_System_CreateSound(system, "Deadlocked.mp3", FMOD_DEFAULT, 0, &sound);
    printf("%d\n",result);
    
    result = FMOD_System_PlaySound(system, sound, 0, false, &channel);
    printf("%d\n",result);

    sleep(1000);
    
    return 0;
}

I have tested 44.1, 48, and 96khz outputs, and fmod versions 2.03.13 2.02.34, 2.01.23
For platforms, I have tested Linux, Windows (albeit through wine), and also the Wavwriter output (which seems to cause doubled resampling artifacts, different problem)
Previous topics mentioning MP3 quality loss say the solution was setting resample mode to Cubic or Spline, unfortunately this only cleans up resampling artifacts, 16khz+ is still missing

Ogg, Opus, WAV, and FLAC all do not have this problem.

Hope i’m not missing or forgetting anything, thanks in advance!

I can reproduce the 16kHz cut with resampling enabled, but not with resampling disabled.
Since you mention varying result between audio file it may have something to do with file encoding- can you please upload “Deadlocked.mp3” to your FMOD Profile for me to take a look?

Thanks for the reply. I took a look at uploading the file to my account, but to upload I need a project, and to make a project I need to select an industry other than non-commercial/hobbyist

If I could save a bit of time bothering with that, do you mind downloading a version the song from Newgrounds instead? I’ve checked that it reproduces the problem, and it does

You can get the mp3 here: https://www.newgrounds.com/audio/listen/503731 , look to the right of the name for the download button.

I could also try any mp3 file that works for you to see how it goes on my end, if you have a good way to share it.

(And for what it’s worth, I’ve tried both encoding with FFmpeg and a version of LAME from 1999 with the same results.)

I can see some attenuation above 16khz with that file, and a second shelf at 20khz which suggests an issue with the decode in those bands, I will pass that on to the Dev team to investigate further.
If you can get away with the additional space in your game, your best option for now is to re-export your mp3 as a wav, which I’m finding decodes accurately without any unexpected aliasing or shelving.
Thank you for bringing this issue to our attention!

Seems like the 20/18khz shelf happens to all sound files, even lossless. Maybe some kind of final post processing step?

If you’re able to share what the problem was after it’s resolved, I’d love to hear about it!