Skip to content

ArbitraryCombination/FluidSynthUnity

Repository files navigation

FluidSynth Unity

FluidSynth ported to C# through Midi Player Tool Kit (Unity Asset) with Unity bindings. Comes with NVorbis OGG Vorbis decoder.

All parts are heavily modified: stripped down and optimized. Stripping down relates to playing MIDI files, stereo sound and other features that were not needed for Omnibullet. The goal was to optimize performance and the binary size.

This allows the system to load the whole sound font under 1ms, keep the memory usage down and work with good latency. (Although if you want a good latency, you may need to get creative with the API: The toy API used in the sample example project uses Unity's OnAudioFilterRead which has terrible latency. Omnibullet uses a different approach based on dynamically generated AudioClips to reach near zero latency.)

How to use

See the samples. This is not a plug and play package, you may still need to do some coding.

Install

Open Packages/manifest.json with your favorite text editor. Add following line to the dependencies block:

{
  "dependencies": {
    "cz.omnibullet.fluidsynth-unity": "https://github.com/ArbitraryCombination/FluidSynthUnity.git"
  }
}

License

The project builds upon multiple separately licensed components:

Note that while the modifications are under 0BSD, you still must follow the terms and conditions of other licenses.

Contributing

  1. Fork this repository (For further details, see https://docs.github.com/en/github/getting-started-with-github/fork-a-repo)
  2. Develop changes to a new branch to your forked repository
  3. Create a Pull Request from your forked repository against this repository
  • Pull request description should answer these questions: "What has been changed" and "What is this for"

Developing

One way to develop this Unity package is to create a new Unity Project and copy this package to its Assets folder.

This way .meta files (required by Unity) are generated automatically. Assets available in the package can now be tested and developed inside the project.

After making changes you can test your package by eg. installing it via Git URL:

Open Packages/manifest.json with your favorite text editor. Add following line to the dependencies block:

    {
        "dependencies": {
            "com.arbitrary-combination.FluidSynthUnity": "https://github.com/ArbitraryCombination/FluidSynthUnity.git"
        }
    }

For further details, see Unity docs about custom packages.