1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Sample-free General MIDI synthesizer.
//!
//! `rumpl` renders Standard MIDI Files without any SoundFont or sample
//! library: every instrument is synthesized — from oscillators, envelopes,
//! filters and FM for the synth sounds, and from physical models for the
//! acoustic ones: Karplus-Strong plucked strings, modal pianos, bars, bells
//! and membranes, and digital waveguides for bowed strings and winds.
//!
//! The library entry points are:
//!
//! - [`midi::load`] — parse a `.mid` file into a [`midi::Sequence`].
//! - [`output::render::render_to_wav`] — render a sequence offline to WAV.
//! - `output::play::play` — play a sequence in real time. Only available
//! with the `play` feature, which uses [cpal](https://crates.io/crates/cpal)
//! and on Linux needs the ALSA development headers (`libasound2-dev`).
//!
//! To use it as a library without the CLI dependencies:
//!
//! ```toml
//! rumpl = { version = "0.2", default-features = false, features = ["play"] }
//! ```
//!
//! ```no_run
//! # fn main() -> anyhow::Result<()> {
//! let seq = rumpl::midi::load(std::path::Path::new("song.mid"))?;
//! rumpl::output::render::render_to_wav(
//! &seq,
//! std::path::Path::new("song.wav"),
//! 44_100,
//! 0.8,
//! 3.0,
//! )?;
//! # Ok(())
//! # }
//! ```