Fmod Unity

Posted on  by 



FMOD Event Player - An auditioning tool clarification needed in conjunction with FMOD Designer 2010. The FMOD sound system has an advanced plugin architecture that can be used to extend the support of audio formats or to develop new output types, e.g. FMOD Studio VCA volume control in Unity FMOD Studio gives us the ability to couple busses to specific VCAs. This is useful, for example, when we want to control the volume of music and sound effects separately. Whether you're a composer new to games or a veteran sound designer, FMOD provides resources for all stages of learning. Quickly get started by integrating FMOD into a Unity project, following our step-by-step guide.

The audio in Mini Metro is being designed by Module. He’s the genius behind Shatter and many other great-sounding titles, so we’re stoked to have him on board. His weapon of choice is FMOD Studio which has an official Unity plugin – handy!, but as a native plugin it requires Unity Pro, which we’re too tight to shell out for – stink!

Before I coughed up $4.5k for Pro licences for desktop, iOS, and Android, I had a bit of a poke around and, fairly easily, managed to get FMOD Studio working fine with non-Pro Unity.

There are two problems to tackle in getting a native library to work with Unity; binding the necessary C functions so they can be called from C#, and getting a standalone executable to locate the library at runtime. Binding is straightforward as C# has a brilliantly-simple way to do just that so I’ll cover that first.

Make sure Live Update is enabled in the FMOD Unity Settings, Port 9264 is the default, and that your application has networking permissions. 12.3 Assembly Reference Error Unity 2018.4.12 and below do not include some assemblies referenced by FMODUnity.asmdef and FMODUnityEditor.asmdef. In these versions of Unity you will see these messages. 'The FMOD & Unity Essentials course is a fantastic way to bridge the gap between audio middleware and game engine. It's given me a better understanding of the integration process and a more holistic skillset for game audio.' Elliot Callighan Composer & Sound Designer For Media 'I had a blast learning from Henry with this course.

C to C# function binding

C#’s DllImport API is fantastic compared to any other cross-language binding I’ve done in the past. It is located in System.Runtime.InteropServices.DllImport. All you need to do is prefix the C# prototype of the C function you want to call with a call to DllImport, and all the magic happens for you. So, for example, if I want to call the function to create an FMOD Studio system, which has the C prototype:

FMOD_RESULT F_API FMOD_Studio_System_Create(FMOD_STUDIO_SYSTEM **system, unsigned int headerVersion);

All I need to is declare the following prototype inside of a C# class:

And we’re done! Well, almost. The FMOD_RESULT is obviously not a known type, so we need to take care of that. The C API defines FMOD_RESULT as an enum:

We can easily emulate it in C# by declaring a similar enum:

Now we can pass FMOD_RESULT between C# and C and it will be translated correctly. So to call the function, all you do is:

Done! From here, abstracting the rest of the API is a trivial (if repetitive) task. I can upload my barebones FMOD Studio C# wrapper if required, just shoot me an email or tweet.

Bluestacks BlueStacks 4.130.1.1001 Release Note. Create shortcut keys for common actions. You may now create shortcut keys to access/ perform certain actions with the keyboard keys instead of using the mouse (which takes more time). The predefined, default, values for the shortcuts appear below. Boss key - Ctrl + Shift +X.

Locating the dynamic library

Unfortunately that’s not the hard part of integration; getting a standalone Unity build to locate the appropriate DLL is the tricky, platform-specific part.

At least it’s difficult on OS X. Good ol’ Windows doesn’t much care where it loads a DLL from, so just copy the required DLLs to the same directory as the executable, and you’re away laughing.

OS X is much more strict about which dynamic libraries it loads. This is to its credit, but as a developer it can be a pain! Here’s how I did it:

  1. When specifying the DLL name to DllImport, specify a path relative to @executable_path. In my case for FMOD Studio, I used @executable_path/./SharedSupport/libfmodstudio.dylib.
  2. After building the standalone OS X build, copy the required dylibs into the directory you specified in the previous step.
  3. Using install_name_tool, change the id of each of the dependent libraries to the same as the path you specified to DllImport. So for FMOD Studio, run install_name_tool -id @executable_path/./SharedSupport/libfmodstudio.dylib libfmodstudio.dylib.
  4. If those libraries themselves have any further dependencies (such as libfmodstudio.dylib depending on libfmod.dylib), copy them to the same directory. Using install_name_tool change their id, and the names they are referenced by in the dependent libraries, to something appropriate. So for FMOD, I changed both libfmod.dylib’s id and libfmodstudio.dylib’s reference to libfmod to @executable_path/./SharedSupport/libfmod.dylib.

Clear as mud!

So far I’ve managed to get FMOD Studio running on Windows and OS X. I don’t anticipate Linux to be too much trouble, assuming FMOD release binaries sometime soon! Android and iOS will be straightforward as Unity generates the projects, rather than building executables behind your back.

Fmod Unity

Logitech g hub mouse reset. In this article you will find a guide to configure the Oculus Spatializer in FMOD Studio and then use it in Unityto build amazing Virtual Reality experiences for Oculus Quest!

Why should I go through all this pain?

If you are working on a VR project you know that audio is basically very very important.

Fmod

The advantages of using an audio middleware to speed up your projects are many but something setting everything up can be messy.

I’ve been using the Oculus Spatializer for quite a while now and I believe it offers one of the best HRTF out there.

I’m assuming you already have installed the latest version of FMOD and Unity.

FMOD set up

First thing we need to get the spatializer plugin inside FMOD Studio.
Go ahead and download the package from the Oculus website.

As I’m writing this article, version 12.0.0 is the latest release.
Here’s how the folder presents itself.

Unity

The interesting stuff for this step are:

  • Studio
  • x64

As you have this opened, look for the installation folder of FMOD in you computer.
Mine is C:Program FilesFMOD SoundSystemFMOD Studio 2.00.0x

Inside here there’s a folder named “plugins“.
You need to copy all the files from “Studio” and “x64” into that folder. So far it wasn’t so bad, wasn’t it??

You are all set up now!
If you create a new FMOD project you’ll now find the option for Oculus Spatializer in the menu.

When working with Oculus Quest, remember to build your banks for Mobile as well!

Unity set up

Now the Unity part… what we need are two things:

  • Oculus Spatializer package for Unity (we’ve downloaded it already)

Go ahead and import the integration for Unity, like any other package: double click on it while you have Unity opened in the background.
Now do the same think with the package you’ll find in the Spatializer folder.

Set the project path, so that Unity knows where FMOD project is located.
Go to the FMOD menu at the top and select “Edit Settings”

Now, in the inspector, select “project” and look for the FMOD Studio project file in your computer.

Tell FMOD you are using a plugin, add the string “OculusSpatializerFMOD” in the section Plugin.
Also make sure your speaker mode matches the one you’ve set in FMOD Studio!

If you are using Ambix files set FMOD to 5.1.
I know that Oculus documentation tells us to use Stereo, but if you do so, the routing of Ambisonics files isn’t quite right, so use surround and then only use the left and right channels on the master (as suggested by Gianni Ricciardi).

How many more steps????
Don’t worry we are almost there, just need to handle a little mess with the folders.

Last step, go in the assets folder and look for “Plugins/FMOD“.
Copy and paste the file OculusSpatializerFMOD.dll from Plugins/FMOD/x86_64 to Plugins/FMOD/win/x86_64

This is something that they should fix soon, basically they’ve changed FMOD integration folder structure, and the guys from Oculus haven’t caught up yet…

Now delete the folders Plugins/FMOD/x86_64 and Plugins/FMOD/x86 and you should be done!
If you don’t do so, you’ll have problems during build time, so make sure you have your folders fixed up.

This is how in the end folders should look like:

Building an app

It’s now time to create your application for quest.

Before you do, kill Unity’s audio engine, you don’t really need it, since we are using FMOD.

Go to Edit/Project Settings/Audio and flag “Disable Unity Audio

Now you are ready to build without errors!!! Enjoy everything working smoothly!!

IMPORTANT
You can always be getting errors during build time!

At least now you should be confident that if you have any problems you should be looking somewhere else than FMOD integration!

Fmod Designer Download

When updates come out.

Fmod Unity Integration

When either FMOD or Oculus update their software you might want to update as well, there are often new features and bug fixes.

To update everything follow these steps:

Fmod Unity Integration

  • Update plugin files for FMOD Studio, build your banks.
  • Delete all FMOD files from unity, as well as dll (to delete dll files is better if you close unity and work directly in the project folder)
  • Reimport new packages and configure Unity like described in the article




Coments are closed