Skip to main content

Module text

Module text 

Source
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 with lyric_separation before each but the first: music21’s assembleAllLyrics. Lines one to max_lyrics - 1 are 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_number counts 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, The for The Ale is Dear: music21’s postpendArticle. language is read as prepend_article reads it.
prepend_article
A title with an article written after a comma at its end put back in front, The Ale is Dear for Ale is Dear, The: music21’s prependArticle. language is a code from ARTICLES; with none, every language’s articles are looked for. Text with no such article is handed back as it is.