FMOD native extension


Hi there!

After weighing in our options, we decided to use FMOD for our game, so I tried to make a proof of concept that it can be integrated with Defold.

Defold FMOD is the result of that work. It’s still quite experimental, mainly because Defold doesn’t officially support dynamic libraries (DEF-2732).

Github link
Asset portal link

Platform support is as such:

  • macOS & Linux: It works :tada:
  • Windows: It works, with a small workaround for running in the editor.
  • iOS: It works :tada:
  • Android: Nothing attempted yet.
  • HTML5: It works :tada:

On Windows MSVC crashes when compiling LuaBridge (lol).

Because of the above issues I think I’ll try compiling the bindings into a separate dynamic lib, which I will dlopen() from the native extension. (Because fetching all the FMOD symbols this way would be a pain in the ass and it’s easier to make a lib, link it with FMOD and expose a few entrypoint symbols to the NE).

I’m not sure what to do about the MSVC crash, though. Maybe the above approach might work by virtue of compiling the module with another version of MSVC.


I managed to make it work on Windows, Linux and macOS. To work around needing to bundle licensed FMOD headers, the extension is compiled separately as a static library (also, when compiling the Windows code on Defold’s build servers, MSVC crashed).

On Windows, this links directly to the FMOD DLLs and on macOS and Linux, the FMOD libraries are loaded at runtime with dlopen(). The macOS and Linux builds also intelligently figure out that they’re running in the editor (where the libs aren’t bundled) and look for the libs in the user’s project directory, in the dir specified in bundle_resources in game.project.

Next up, making the call to FMOD::System::setSoftwareFormat customisable and then expanding the exposed API surface.


Nice job!


Very interesting.

I give a try , as i know FMOD is able to read music modules (xm, s3m…).

It would be nice for my little game, as it would avoid converting 64kb modules to 4mb OGG files. (I could divide the size of my game by two, this way.)


So, now you can set the speaker mode (necessary for loading banks). Also, I managed to expose all the APIs in FMOD::Studio, minus the callbacks. I think this should be roughly enough for this extension to be useful. :microphone:

Before I’ll dig into the low level APIs, I should try to automate writing bindings, as the API surface is huge (especially for the low level API).

If you try it, please open issues if something seems wrong. There is a lot of glue code in this extension that I can’t possibly test on my own (since FMOD is so big). Also, if you have suggestions towards which parts of the low level API I should start with, fire away!


Awesome job.
We are soon starting to work on sounds for our game and I will definitely look into your FMOD extension and hope to at least give you feedback and suggestions.


Added iOS support and a config option to enable FMOD Studio’s live reload feature. Also, started using it in my own game and ironing out the bugs.

Update: Added HTML5 as well.


Good news! I got permission to distribute the FMOD libs alongside defold-fmod, which means installing the extension is a whole lot easier now. Also updated it for FMOD 1.10.03.

Don’t forget to remove the old fmod_stub approach from your project.

UPDATE: I also made it link at runtime on Windows, so no more weird system32 hacks.