https://github.com/katyo/fluidlite-rs
Rust bindings to fluidlite library
https://github.com/katyo/fluidlite-rs
Last synced: 3 months ago
JSON representation
Rust bindings to fluidlite library
- Host: GitHub
- URL: https://github.com/katyo/fluidlite-rs
- Owner: katyo
- Created: 2020-02-06T18:45:14.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-21T19:57:30.000Z (over 2 years ago)
- Last Synced: 2025-03-23T21:11:28.212Z (4 months ago)
- Language: Rust
- Size: 370 KB
- Stars: 16
- Watchers: 4
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Rust fluidlite bindings
[](https://github.com/katyo/fluidlite-rs)
[](https://crates.io/crates/fluidlite)
[](https://docs.rs/fluidlite)
[](https://opensource.org/licenses/LGPL-2.1)
[](https://github.com/katyo/fluidlite-rs/actions?query=workflow%3ARust)This project aims provide safe Rust bindings to [fluidlite](https://github.com/katyo/fluidlite) C library.
> FluidLite is a very light version of FluidSynth designed to be hardware,
> platform and external dependency independant. It only uses standard C libraries.
>
> It also adds support for SF3 files (SF2 files compressed with ogg vorbis)
> and an additional setting to remove the constraint of channel 9 (drums):
> fluid_settings_setstr(settings, "synth.drums-channel.active", "no");
> you can still select bank 128 on any channel to use drum kits.
>
> FluidLite keeps very minimal functionnalities (settings and synth),
> therefore MIDI file reading, realtime MIDI events and audio output
> must be implemented externally.## Crates
* [__fluidlite__](https://crates.io/crates/fluidlite) Safe bindings
* [__fluidlite-sys__](https://crates.io/crates/fluidlite-sys) Unsafe bindings (generated using bindgen)## Features
* __bindgen__ Force generate bindings itself instead of use pre-generated
* __builtin__ Force compile builtin _fluidlite_ C-library
* __pkg-config__ Use _pkg-config_ to find installed libraries
* __with-sf3__ Enable _SoundFont3_ support (SF2 with vorbis-encoded samples)
* __with-stb__ Use _stb-vorbis_ decoder instead of _libvorbis_/_libogg_.
* __shared__ Build shared _fluidlite_ C-library
* __static__ Build static _fluidlite_ C-libraryWhen __pkg-config__ feature is used the installed __fluidlite__ library will be used if found. To force build and link builtin version you can use __builtin__ feature.
## Example
```rust
use std::{fs::File, io::Write};
use byte_slice_cast::AsByteSlice;
use fluidlite::{Settings, Synth};let settings = Settings::new().unwrap();
let synth = Synth::new(settings).unwrap();
synth.sfload("sf_/Boomwhacker.sf3", true).unwrap();let mut buffer = [0i16; 44100 * 2];
let mut file = File::create("soundfont-sample.pcm").unwrap();synth.note_on(0, 60, 127).unwrap();
synth.write(buffer.as_mut()).unwrap();
file.write(buffer.as_byte_slice()).unwrap();synth.note_off(0, 60).unwrap();
synth.write(buffer.as_mut()).unwrap();
file.write(buffer.as_byte_slice()).unwrap();
```