Skip to main content

Module lily

Module lily 

Source
Expand description

LilyPond, written as music21 writes it. LilyPond, written as music21’s lily.translate writes it.

music21 builds a tree of LilyPond objects (lily.lilyObjects) and writes it out, each object indented by how many objects stand above it – which depends on the order the tree was put together in, since an object takes the parent it was last given as an attribute, or the first list it was put in, and none when it is appended to a list afterwards. The tree is kept here as music21 builds it, parents and all, so the text comes out as music21’s does, space for space.

use music21_rs::lily::{LilyOptions, to_lilypond};
use music21_rs::tinynotation::from_tiny_notation;

let line = from_tiny_notation("4/4 c4 d8 e f#4. g8")?;
let text = to_lilypond(&line, &LilyOptions::default())?;
assert!(text.starts_with("\\version \"2.24\""));
assert!(text.contains("fis' 4."));

Structs§

LilyOptions
How a LilyPond file is written.

Functions§

to_lilypond
A stream written as LilyPond, as music21’s LilypondConverter’s textFromMusic21Object writes it: a score’s parts each on a staff, its voices, measures with their barlines, pickups, clefs, keys, meters, tempi, breaks, notes, rests and chords with their beams, stems, ties, fermatas, tuplets and colours, and each part’s lyrics. A stream that is not a score is written as the one part of a score.