Expand description
Lyrics joined into words and lines, and the articles of titles.
Text in scores: music21’s text module. The lyrics of a stream joined
into words and lines, the articles of a title moved to its front or its
end, and the TextBox a page carries.
use music21_rs::text::{assemble_lyrics, prepend_article};
use music21_rs::tinynotation::from_tiny_notation;
let mut line = from_tiny_notation("4/4 c4_Hi d4_there")?;
assert_eq!(assemble_lyrics(&line, 1, " "), "Hi there");
assert_eq!(prepend_article("Ale is Dear, The", None)?, "The Ale is Dear");Structs§
- TextBox
- Text standing anywhere on a page, its title or a header: music21’s
TextBox, MusicXML’s<credit>.
Constants§
- ARTICLES
- The articles of each language music21 knows, by its language code:
music21’s
articleReference.
Functions§
- assemble_
all_ lyrics - Every line of a stream’s lyrics, each assembled by
assemble_lyrics, one after another withlyric_separationbefore each but the first: music21’sassembleAllLyrics. Lines one tomax_lyrics - 1are read, as music21 reads them, and a line with no lyrics at all is left out, though a separator still comes before each line after the first. - assemble_
lyrics - The lyrics of one line of a stream, nested streams included, joined into
words, the syllables of each word run together: music21’s
assembleLyrics.line_numbercounts the lyrics on each note from one, as music21 does, so nought reads each note’s last lyric; a note without that many lyrics is passed over, and so is a syllable that is only an underscore, as many scores write a held syllable. - postpend_
article - A title with the article it starts with moved after a comma at its end,
Ale is Dear, TheforThe Ale is Dear: music21’spostpendArticle.languageis read asprepend_articlereads it. - prepend_
article - A title with an article written after a comma at its end put back in
front,
The Ale is DearforAle is Dear, The: music21’sprependArticle.languageis a code fromARTICLES; with none, every language’s articles are looked for. Text with no such article is handed back as it is.