Skip to main content

type_to_musicxml

Function type_to_musicxml 

Source
pub fn type_to_musicxml(value: &str) -> Result<&str>
Available on crate feature musicxml only.
Expand description

music21’s typeToMusicXMLType: the MusicXML <type> for a music21 duration type, which is the type itself but for longa, written long. The types MusicXML has no value for are refused.

use music21::musicxml::type_to_musicxml;

assert_eq!(type_to_musicxml("longa")?, "long");
assert_eq!(type_to_musicxml("16th")?, "16th");
assert!(type_to_musicxml("duplex-maxima").is_err());

§Errors

2048th, duplex-maxima, inexpressible, complex and zero, each with music21’s message.