I seem to be missing some key concepts in the FMOD documentation.
My end goal is an audio dsp effect in a unity project, which I presume requires a studio plugin that matches.
I can build the core and studio api and examples using VS2022 (with no upgrade selected) from the FMOD Studio Engine install, but they produce executables and not dynamic libraries.
What is the connection between a dsp effect built for unity and the FMOD studio plugin?
Is there some documentation that I’m missing?
Edit: VS2019 produces the same results.
How do you add these examples into FMOD Studio and a Unity project?
Hi,
There’s essentially two ways of handling DSP plugins with FMOD.
The first way is to create a DSP solely in engine, entirely programmatically. The DSP Capture scripting example in the Unity Integration docs is handling creating a DSP this way. Put simply, you create the DSP_DESCRIPTION
, specify the relevant information as well as callbacks to handle the data that will be passed into the DSP, create the DSP itself with System.createDSP()
, and add it somewhere to the signal chain - all within a C# script in Unity. The downside to this method is that the plugin won’t be accessible in FMOD Studio.
The other way, which is what you’re trying to do, is to build the plugin as a library that can be used in FMOD Studio as well as in engine. This requires you to do two things:
- Provide a dynamic linked library to FMOD Studio
- Provide your engine with the plugin as source code or a static/dynamic library, and register it in your engine
Info on providing and registering plugins in Unity can be found in the Plugins section of the Unity Integration docs, and general info on plugins in Studio can be found in the FMOD Studio plugin reference. I also highly recommend the DSP Plugin API White Paper, as it’s an extremely useful resource that should contain the majority of the information you need when it comes to understanding how DSP plugins work in FMOD, as well as how to code your own.
As for building .dll files for the Core and Studio API examples, you can change what is built by VS from Project → Properties → General → Configuration Type. The compiled .dll for the examples should build to the Output Path that’s listed in the same General Properties menu - the default build path for an Debug x64 build of fmod_gain.dll
, for example, should be .\_builds\fmod_gain\Debug\x64\fmod_gain.dll
.
Thanks, this was quite helpful.
Can you expound on how the DLLs are properly “installed” into a Unity project? I can get FMOD Studio to load and use my simple effect, but I get no sound at all in a unity game unless I remove it from the build.
It’s like the Unity engine can’t find the library even though it’s in the Asset tree.
As per the Plugins senction of the Unity Integration docs, you need to:
-
Add the DLL to the relevant platform folder at Assets/Plugins/FMOD/platforms/{Platform}/lib
- each platform will need its own version of the DLL
-
Add the DLL’s filename (without extension) to your platform’s “Dynamic Plugins” dropdown under FMOD Settings → Platform Specific
There’s a slightly different process for static libraries and source code, which the docs link above also contains information about.
That was it. Had no idea there was a list for dynamic plugins.
Thanks!