Skip to main content

from_tsv

Function from_tsv 

Source
pub fn from_tsv(text: &str, version: Version) -> Result<Stream>
Expand description

A DCML table read as a score of one part: music21’s TsvHandler.toM21Stream, which prepares the measures from the table’s own measure numbers and meters and then puts each chord in the measure it falls in.

The score is the analysis alone – the numerals and the keys, with no notes of the music they describe – and each numeral lasts until the next, the last to the end of its measure, which is music21’s extendDuration.

use music21_rs::romantext::tsv::{Version, from_tsv};

let table = "chord\tmeasure\tbeat\ttimesig\tglobal_key\tlocal_key\tnumeral\n\
             .C.I\t1\t1.0\t4/4\tC\tI\tI\n\
             V\t2\t1.0\t4/4\tC\tI\tV\n";
let read = from_tsv(table, Version::One)?;
assert_eq!(read.parts().len(), 1);

§Errors

A table with no rows, a meter or a key it cannot read, or a label no numeral can be built from.