Audio quality is different when building Unity project using FMOD integration and Unity Audio

Hello, so recently I found out that my audio quality in my android game feels compressed. When I build my android game with FMOD integrated with Unity and opened in my samsung phone, the sound quality is worse than the ones I monitoring on my PC. The audio quality returns to normal whenever i enable screen recording and worsens when disabled (there is a slight pause when enabling the screen recording, it feels like its switching)

I have discovered that this issue seems to correlate with samsung’s ongoing audio bug but somehow when I build my android game without FMOD integration (using Unity audio), the audio quality is normal as intended even with screen recording.

I have tried different encoding settings but the issue persists.

This my current FMOD build settings for the android platform:

Hi,

In Unity, if you navigate to FMOD Settings → Platform Specific → Android, what is the platform sample rate set to? If it’s set to “Platform Default”, then it’s likely that the FMOD System sample rate is being set to a lower sample rate than expected (i.e. 24kHz), which would result in a notable difference in audio quality. Try setting the platform sample rate to 44.1kHz or 48kHz and see whether that resolves the issue.

Hi, thanks for the reply! I have tried it before but the issue still persist. Also I noticed that when I tried to record my screen the sound become wider as if the sound before was mono and then switched to stereo.

Here are my platform specific settings in Unity:

Thanks for confirming that for me. So I can help diagnose the issue, can I get you to provide the following:

  • Your exact FMOD for Unity version number
  • What Android device you’re using, and its Android version number
  • A log from your Android device where the issue occurs, with your Logging Level in FMOD Unity Settings set to “Log”

Android device: Samsung Galaxy A73 5G
Android version: 13
FMOD-Unity version: 2.02.13

This is a link to the log text. I use Android Logcat to extract the logs when building and running the game on my android device. (I cannot upload the attachment here due I’m still new into the forum, it wont let me) I hope this is the right log. If it’s not please tell me the steps to extract the right log, because I don’t really know how to extract FMOD logs from the android device.

To obtain a log with the information I need, you’ll need to do the following, preferably with a small gap in time between each so each action is distinguisable:

  • Start Logcat while connected to your Android device
  • Run your Unity application on your Android device
  • Enable screen recording on the device to trigger the audio quality to return to normal
  • Disable screen recording on the device
  • Stop Logcat

The log that you’ve uploaded does seem to be the “correct” one, given that Unity is running with FMOD and AAudio opens a stream, but from what I can tell FMOD doesn’t seem to have it’s logging level set to “Log” in Unity → FMOD → Edit Settings → Initialization. Please ensure that you set the correct logging level if you haven’t already.

Hello Louis,
Thank you for the reply. Yes I already set the FMOD logging levels into “Log” when I first used the logcat. Here is the new list (I copy pasted in a word file). Find the word “START OF SCREEN RECORDING” and “END OF SCREEN RECORDING” in the file. The process after start checkpoint is the moment when the audio returned to normal and the process after the end checkpoint is the moment when I change screen and returned to the game and the audio returns to compressed

Link: Loading Google Docs

Thanks for providing the log. Unfortunately, I can’t seem to identify the issue, as the logging output expected from FMOD for Unity isn’t present. I suspect that I’ll have more luck testing the behavior on an Android device on my end though, so if possible, can I get you to upload your Unity project, or a stripped down version where you can reproduce the issue, to the “Uploads” tab of your FMOD Profile?

Hello this is the game uploaded to the GDrive. If you can you please test on two seperate android devices, preferably one in Samsung and one in other brand. Try to screen record during gameplay, if the issue exist, there would be a silent pause for 1 sec and the audio would change (gets better) and if you stop recording return to your phone’s home screen and return to the game the audio would return to compressed.

Link new build:

1 Like

Hi,

Thank you for the project. I have been able to reproduce the issue and have passed it on to our development team to look into further. Unfortunately, there isn’t a workaround at this time. If there are any updates I will update the forum.

Thank you for bringing this to our attention.

Thank you for the FMOD team for helping :smiley: I hope this issue gets resolved quickly.

1 Like

Hi,

After some investigation, it seems that this issue is linked to a previous forum post here: Volume difference between Audio APIs - #2 by jeff_fmod.

Unfortunately, we are not able to solve the issue at this time. A workaround may be changing the output used by the FMOD core system to OpenSL.

I would recommend using the Unity Integration | Scripting Examples - Callback Handler to change the output before the FMOD system initializes. To change the output you need to call FMOD Engine | Core API Reference - System::setOutput.

Hope this helps.

Hello,
I thank you for the response, however I have a question. How do I access the FMOD Core API Reference in order to change the output? Thank you

Hi,

The scripting example I linked above: Unity Integration | Scripting Examples - Callback Handler, takes you through the process of getting access to the core API system before it has initialized. You would just need to add the following to the PreInitialize() function:

FMOD.System coreSystem;
result = studioSystem.getCoreSystem(out coreSystem);
reportResult(result, "studioSystem.getCoreSystem");
result = coreSystem.setOutput(FMOD.OUTPUTTYPE.OPENSL);
resportResult(result, "coreSystem.setOutput");

Hello Connor,
Thank you for the help. I will try this and get back to you as soon as possible.

Sincerely,
Christopher Vincent Welax

1 Like

Hello, I have tried creating the script you said and I get this error when try to test the game on desktop and there is no audio when playing the game:

SystemNotInitializedException: [FMOD] Initialization failed : coreSystem.setOutput : ERR_PLUGIN_MISSING : A requested output, dsp unit type or codec was not available.
FMODUnity.RuntimeManager.get_Instance () (at Assets/Plugins/FMOD/src/RuntimeManager.cs:190)
FMODUnity.RuntimeManager.SetListenerLocation (System.Int32 listenerIndex, UnityEngine.GameObject gameObject, UnityEngine.GameObject attenuationObject) (at Assets/Plugins/FMOD/src/RuntimeManager.cs:1313)
FMODUnity.StudioListener.SetListenerLocation () (at Assets/Plugins/FMOD/src/StudioListener.cs:123)
FMODUnity.StudioListener.Update () (at Assets/Plugins/FMOD/src/StudioListener.cs:102)

I’m guessing that OpenSL is solely exclusive to Android, therefore there wouldn’t be any input for desktop/PC?

I also tried running the test on my Android and it fixed the problem. But I would like to know how to fix the error that I encountered on my desktop test first

Apologies, there is an easier way to do this that I overlooked.

In the FMOD integration settings you can use the Output Mode (Unity Integration | Settings - Output Mode) to select OpenSL just for Android:
image

This way OpenSl will only be used on Android. Let me know if that works.