Skip to main content

to_roman_text

Function to_roman_text 

Source
pub fn to_roman_text(stream: &Stream) -> Result<String>
Expand description

Writes a score’s roman numerals as a RomanText analysis, as music21’s romanText.writeRoman.RnWriter writes one, a line after each line.

The header names the composer, the title (with the movement’s number and name), the analyst and the proofreader, as the score’s metadata gives them. Then measure by measure: a Time Signature: line where a meter stands, and a line of the measure’s numerals – each chord standing for one (Chord::numeral) at its beat, b2.5, beat one left unsaid, the key written before a numeral where it is not the key of the one before, and a chord tied from the one before passed over – with ||: and :|| where a repeat starts and ends. A score is written from its first part, an opus score by score.

use music21_rs::romantext::{from_roman_text, to_roman_text};

let score = from_roman_text("Time Signature: 3/4\nm1 G: I b3 V6\nm2 I\n")?;
let written = to_roman_text(&score)?;
assert!(written.ends_with("Time Signature: 3/4\nm1 G: I b3 V6\nm2 I\n"));

§Errors

A numeral standing where a meter has no beat.