#synthesizer #midi #sound-font

xsynth-realtime

A real-time MIDI synthesizer using XSynth

4 releases (2 breaking)

0.3.1 Aug 25, 2024
0.3.0 Aug 23, 2024
0.2.0 Aug 10, 2024
0.1.0 Aug 6, 2024

#1013 in Audio

Download history 307/week @ 2024-08-06 18/week @ 2024-08-13 264/week @ 2024-08-20 26/week @ 2024-08-27 5/week @ 2024-09-10 3/week @ 2024-09-17 14/week @ 2024-09-24 26/week @ 2024-10-01 3/week @ 2024-10-08

211 downloads per month

LGPL-3.0

225KB
5.5K SLoC

xsynth-realtime

The real-time rendering module within XSynth. Currently it outputs audio using cpal.

It uses an asynchronous event sending system for high performance and simple to use API.

Documentation

You can find all the necessary documentation about the XSynth realtime API here: https://docs.rs/xsynth-realtime.

Example

This is a very simple example about initializing an instance of the realtime synthesizer. For other more detailed use cases, visit the examples folder.

use xsynth_realtime::{RealtimeSynth, SynthEvent, ChannelEvent, ChannelAudioEvent};

fn main() {
    // Will use the default configuration and
    // default audio output device
    let mut synth = RealtimeSynth::open_with_all_defaults();
    
    // Will send a note on event in channel 0
    synth.send_event(SynthEvent::Channel(
        0,
        ChannelEvent::Audio(ChannelAudioEvent::NoteOn {
            key: 60,
            vel: 127,
        }),
    ));

    // Will print the active voice count
    println!("Voice Count: {}", synth.get_stats().voice_count());

    // The synth is automatically dropped here
}

Dependencies

~10–41MB
~704K SLoC