Can't properly load Vorbis compressed Bank , help please

Hello. Does someone know if it is possible to properly load my old bank Vorbis files? Audio plays and works, but I constantly get warnings and errors, as shown in the 1st pic.

I have tried to load with FLAGS.DECOMPRESS_SAMPLES. All warnings and errors disappeared; everything is cool except for the huge 10x more RAM consumption, as shown in the 2nd pic. too much for mobile device

Compression type - Vorbis
Unity Integration 2.01

couldn’t upload big-sized FMOD project to the cloud, so I have lost the project folder.
Have searched solution all around forum -no results.
Thank you very much.

Start(){
        RuntimeUtils.EnforceLibraryOrder();
        foreach (var bankRef in Banks)
        {
            try
            { RuntimeManager.LoadBank(bankRef, true); }
            catch (BankLoadException e)
            { RuntimeUtils.DebugLogException(e);  }
        }
        RuntimeManager.WaitForAllSampleLoading();}

Looks like the file being read is smaller than expected and we are hitting the end of the file sooner than expected. Possibly a corrupt file or some unaccounted for incompatibility. What version of FMOD Studio was used to create these old banks, and what is the exact version of the FMOD Unity integration you are using?
Can you please upload your banks to your FMOD Profile so I can try reproducing this issue on my end?

1 Like

Thank you for the answer.
Pardon, I couldn’t upload files to my profile, so I just uploaded them to GitHub. You can find them here on GitHub. You can Just put these three bank files into the FMOD project\Build\Desktop folder, and attach script to any GameObject. Press Play, and the sound should start.

For convenience’s sake, I uploaded the smallest one, but in the project, there are 15+ banks with SFX, 400+ voice lines, vehicle sounds, etc. Originally, I worked with FMOD Studio 1.08 because all example/tutorial projects were on that version. Afterward, I built all banks in PCM and in Vorbis but used only PCM due to low CPU consumption. So, I have both PCM and Vorbis variations of the same banks.

Is it possible to somehow bypass that size check, or wait another 1-2 seconds for proper load, or maybe convert that PCM to Vorbis again but in another way?
At the moment, I’m developing a big mobile game (90% ready) and want to use Vorbis because of the file size difference (20+MB vs. PCM’s 300+MB). The project fully uses the FMOD audio system. I’m stuck on this (my failure),and can’t move on

Question 2.
Although I didn’t want to bother you with second question, but i don’t left any ideas what to do.
: How to compile the “Distance Filter” for android?

What I have done so far:

  1. I have read almost all 20k forum topics/posts and found out that the easiest way to get the plugin for Android is to download the old FMOD Android API (v1.10) with api\lowlevel\examples\vs2010\examples.sln , along with NVIDIA CodeWorks and VS 2019.
  2. In examples.sln, I chose the type as “release” and the architecture as arm64-v8a.
  3. I compiled and obtained “libfmod_distance_filter.so” with a size of 19kb.
  4. I imported it into FMOD\platforms\android\lib\arm64-v8a with import settings platform set to ARM64.
  5. In FMOD settings and Android settings, I added “fmod_distance_filter” to dynamic plugins.
  6. The result is an error on Android:
    “Error Unity SystemNotInitializedException: [FMOD] Initialization failed: Loading plugin ‘fmod_distance_filter’ from ‘libfmod_distance_filter.so’: ERR_FILE_NOTFOUND: File not found.”

Device information: Android 13, ABI: arm64-v8a.




I have been trying to obtain the Android versions of the Distance Filter for a week already, running back and forth with different combinations of the plugin name, platform, etc. Can’t understand what I’m doing wrong and what I need to do to get these .so files for armv7, arm64, x86, x64.
also tried to build all 4 version and import .so files to their folders with proper import settings- no luck.

It’s a pity that Google’s policies don’t let you include this Distance Filter plugin for Android. As soon as I understand how to build it, I’ll create a guide on GitHub for noobs like me.

i would be so happy if you help to find solution. i been doing this game for 3 yrs and so tired. sound was the last part of development. thx

Forgot to mention a version.

,at moment Fmod unity integration v2.02.19
I can use any version as long as it works .

Tested with v2.01.05, same error.
“sound open failed. result =16”

Why is there no Plugin-Building Example for Android Studio like in old (lowlevel\examples.sln) or a tutorial? I’ve been delving into all this C++, compiling, #include “fmod.hpp” stuff. However, I’ve come to the conclusion that I’m too old for all that. I studied this Tutorial, but it ends exactly at the “how to build” part.
Then tried to adopt app examples to build distance_filter.so plugin- :smiling_face_with_tear: got even more confused.

I have read :notebook_with_decorative_cover: the entire FMOD documentation and whitepapers, but there is only information on how to write the plugin itself. I assume fmod_distance_filter.cpp from the Windows API will work for Android too, but I only have to compile it.

I feel like I’m only one tiny step away from everything working, but at the same time, I’ve already lost 1.5 weeks in one place.

Thank you for sending those over- it took a little bit of extra setup but I have managed to play audio from your Vorbis banks on an Android device using the 2.01.23 version of the Unity integration.

The problem appears to be that these banks have a dependency on the fmod_distance_filter plugin. We do not have a .so version of this plugin, as you have discovered, so you will need to static link the source code instead. Here are the steps to do so:

  1. Open the distance “fmod_distance_filter.cpp” file in a text editor and change the fmod.hpp include to fmod.h- this is just for compliance with Unity’s source requirements.
#ifdef WIN32
    #define _CRT_SECURE_NO_WARNINGS
#endif

#include <math.h>
#include <stdio.h>
#include <string.h>

#include "fmod.h" // Changed from "fmod.hpp"

...
  1. In Unity, switch your backend to IL2CPP for both Desktop and Android.
  2. Create a new folder in the root of your Assets directory called “DSP Source”.
    image
  3. Drag the “fmod_distance_filter.cpp” file into this directory.
    image
  4. Download the same version of FMOD Engine as your Unity integration. This is so we can include additional source files that fmod_distance_filter depends on.
  5. Right click on the FMOD Engine installation and unzip it to your downloads directory.
  6. Navigate to “\fmodstudioapi20123win-installer\api\core\inc” and select the following files.
    image
  7. Drag them into your “DSP Source” directory.
    image
  8. In your FMOD Unity settings, add a new static plugin for your mobile platform with a value of FMODGetDSPDescription
    image

With that, you should be able to build for Android, and your banks should load without issue now that they have access to the fmod_distance_filter source.

I know there are a lot of steps with a lot of things that can go wrong, so please let me know how you go with that setup and I will try to help you through any other problems you encounter.

1 Like

Thank you very much , for elaborate instruction and for your personal time (didn’t expect you’ll test it on android). Plugin works perfect. I believe this functionality will be an eye-opener for future Forum wanderers. :grinning:
Copied post to Github for convenience.

80% of problems solved.:+1:
Unfortunately find out that Vorbis loads not only with warnings/errors as i mentioned in initial post ,but also doesn’t play some sound files from giud (plays 2 instead of 3 wavs, depending on rmp).
although in android log- no warnings.

strange that vorbis with “LOAD_BANK_FLAGS.DECOMPRESS_SAMPLES” works right on android too.
Will examine further. :face_holding_back_tears:

No problem, glad I could help. Regarding the waveform errors, if you are building with split application binaries (obb resource files) then the issue could be that the resource isn’t fully loaded by the time you start loading banks. This could explain why the end of file is arriving sooner than expected.
To fix this, you would need to load your banks asynchronously- which is a little different to calling RuntimeManager.LoadBank and blocking on RuntimeManager.WaitForAllSampleLoading as you are doing in Start.
We have an example in the scripting docs- if you are still encountering this issue it would be worth implementing asynchronous bank loading and seeing if that helps at all.

1 Like