A downloadable Godot Plugin

Download NowName your own price

# FluidSynth Godot Wrapper (Alpha)

Bring the power of SoundFont 2 synthesis to Godot 4!

This C# addon wraps the legendary **FluidSynth** library, allowing you to play MIDI files and generate real-time audio using SoundFonts (.sf2) directly within Godot.

**⚠️ Alpha Release**: This is an early version. Features are working, but you may encounter bugs. Feedback is highly appreciated!

## ✨ Features

*   **Real-time Synthesis**: Trigger notes (`NoteOn`, `NoteOff`) dynamically from your C# scripts.

*   **MIDI File Playback**: Play standard `.mid` files with full control.

*   **Native Audio Integration**: Audio is fed directly into Godot's `AudioStreamGenerator`, so you can route it through Godot's audio buses and apply effects (Reverb, Delay, etc.).

*   **Commercial Ready**: Designed with LGPL compliance in mind (uses dynamic linking).

## 🚀 Installation

1.  Download the zip and extract the `addons/FluidSynthGodot` folder into your project.

2.  **Build** your C# solution.

3.  Enable the plugin in **Project Settings > Plugins**.

### 📦 Dependencies

*   **Windows**: Included! The necessary DLLs are bundled with the addon.

*   **macOS**: Install via Homebrew: `brew install fluid-synth`

*   **Linux**: Install via apt: `sudo apt install libfluidsynth3`

## 🛠️ Usage

1.  Add a `FluidSynthPlayer` node to your scene.

2.  Add an `AudioStreamPlayer` child node.

3.  Set the `Stream` of the AudioStreamPlayer to `AudioStreamGenerator` (Buffer Length: ~0.1s).

4.  Assign the AudioStreamPlayer to the `FluidSynthPlayer`.

5.  Load your `.sf2` SoundFont.

```csharp

var synth = GetNode<FluidSynthPlayer>("FluidSynthPlayer");

// Play a MIDI file

synth.PlayMidi("res://music/background.mid");

// Or play notes manually

synth.NoteOn(0, 60, 100); // Channel 0, Middle C, Velocity 100

```

## 📄 License

*   **Addon Code**: MIT License (Free to use in any project).

*   **FluidSynth**: LGPL 2.1 (Dynamically linked).

Download

Download NowName your own price

Click download now to get access to the following files:

FluidSynth Godot Wrapper.zip 3.6 MB

Leave a comment

Log in with itch.io to leave a comment.