MCPcopy Index your code
hub / github.com/BlackMIDIDevs/xsynth

github.com/BlackMIDIDevs/xsynth @0.4.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.4.0 ↗ · + Follow
737 symbols 1,443 edges 90 files 75 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

XSynth

A fast Rust-based SoundFont synthesizer designed for high voice counts and low latency.

GitHub repo size GitHub License GitHub Release

Modules

  • core: Handles the core audio rendering functionality.
  • clib: C/C++ bindings for XSynth.
  • soundfonts: A module to parse soundfonts to be used in XSynth.
  • realtime: The real-time rendering module within XSynth.
  • render: Offline rendering support, exposed both as a reusable library and a command line utility for rendering MIDIs to audio using XSynth.
  • kdmapi: A cdylib wrapper around XSynth to act as a drop in replacement for OmniMIDI/KDMAPI.

API Surface

Most integrations should use the native Rust crates directly: - xsynth-core for soundfont loading and sample rendering - xsynth-realtime for realtime playback against an audio device - xsynth-render for offline rendering to WAV, either as a library or CLI

The non-Rust entry points exist for compatibility: - xsynth-clib exposes a C ABI intended for legacy integrations - xsynth-kdmapi exposes a KDMAPI-compatible DLL for Windows MIDI stacks

Architecture

XSynth is designed around a performance-first voice engine. The hot rendering path is heavily specialized so common voice configurations can stay simple and compiler-optimized.

That design has an important consequence: features that require a large generic runtime modulation graph or many optional per-voice stages are intentionally treated with caution, because they can increase both CPU overhead and binary size. In practice, XSynth prefers to resolve as much soundfont behavior as possible up front during load time.

SFZ Support

XSynth supports a practical subset of SFZ centered around sample-region playback and amplitude/filter shaping.

Supported today: - lovel, hivel, lokey, hikey - pitch_keycenter - volume, pan, tune - sample, default_path - loop_mode, loop_start, loop_end, offset - cutoff, resonance, fil_veltrack, fil_keycenter, fil_keytrack, filter_type - ampeg_start, ampeg_delay, ampeg_attack, ampeg_hold, ampeg_decay, ampeg_sustain, ampeg_release - nested includes and #define substitution in the parser

The SFZ path is intended to cover the common sample-playback workflow well. It is not a claim of full SFZ opcode coverage.

SF2 Support

XSynth aims for high-performance practical SF2 playback rather than full SoundFont 2 spec emulation.

Supported today: - static sample-region playback, including offsets, loop points, stereo links, root key, tuning, scale tuning, key/velocity ranges, fixed key/velocity, filter cutoff/Q, volume envelope generators, and exclusive class - a baked subset of note-on modulators, resolved at soundfont load time, covering key/velocity sources with linear/concave/convex/switch curves for practical destinations such as attenuation, filter cutoff, pan, volume envelope timings, and static pitch offsets

Intentionally out of scope for performance and binary-size reasons: - modulation envelope generators and their destinations - modulation LFO / vibrato LFO generators and destinations - generic runtime SF2 modulators driven by CCs, aftertouch, or pitch wheel - SF2 chorus and reverb send behavior

Realtime And Offline Rendering

  • xsynth-realtime is the realtime playback layer and is the right choice when you need low-latency live MIDI synthesis against an audio device
  • xsynth-render uses the same synth stack for offline rendering and now exposes a reusable library API in addition to the CLI
  • xsynth-core remains the lowest-level crate for the shared rendering and soundfont logic used by both paths

Demos

XSynth playing Immortal Smoke by EpreTroll

https://github.com/user-attachments/assets/d100e3d2-efa0-4367-a774-d5a171ac0bf8

XSynth playing DANCE.MID

https://github.com/user-attachments/assets/f509a36c-6019-4d38-9e5e-1bf0eeb9b43d

License

XSynth and all of its components is licensed under the GNU Lesser General Public License 3.0.

Extension points exported contracts — how you extend this code

SIMDVoiceGenerator (Interface)
The base SIMD voice generator trait [11 implementers]
core/src/voice/simd.rs
ConvertSample (Interface)
(no doc) [3 implementers]
realtime/src/realtime_synth.rs
ConfigPath (Interface)
(no doc) [2 implementers]
kdmapi/src/parsers.rs
VoiceGeneratorBase (Interface)
(no doc) [14 implementers]
core/src/voice.rs
AudioPipe (Interface)
An object to read audio samples from. [4 implementers]
core/src/audio_pipe.rs
SIMDSample (Interface)
The base SIMD voice sample trait, generally either mono or stereo [2 implementers]
core/src/voice/simd.rs
VoiceSampleGenerator (Interface)
(no doc) [3 implementers]
core/src/voice.rs

Core symbols most depended-on inside this repo

clone
called by 109
realtime/src/event_senders/sender.rs
push
called by 49
core/src/soundfont/audio.rs
process_event
called by 28
core/src/channel/mod.rs
load
called by 19
kdmapi/src/parsers.rs
log_kdmapi_error
called by 16
kdmapi/src/lib.rs
send_event
called by 14
core/src/channel/key.rs
parse_float_in_range
called by 14
soundfonts/src/sfz/parse.rs
read_samples
called by 13
core/src/audio_pipe.rs

Shape

Method 359
Function 203
Class 120
Enum 41
Interface 14

Languages

Rust100%

Modules by API surface

core/src/voice/envelopes.rs41 symbols
soundfonts/src/sf2/modulator.rs40 symbols
realtime/src/realtime_synth.rs36 symbols
soundfonts/src/sfz/parse.rs28 symbols
kdmapi/src/lib.rs25 symbols
core/src/voice/sampler.rs23 symbols
core/src/channel/voice_buffer.rs19 symbols
core/src/voice/envelopes/lerpers.rs18 symbols
core/src/voice/simd.rs17 symbols
core/src/buffered_renderer.rs17 symbols
clib/src/realtime.rs17 symbols
core/src/soundfont/mod.rs16 symbols

For agents

$ claude mcp add xsynth \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact