Skip to main content

musicxml_octave

Function musicxml_octave 

Source
pub fn musicxml_octave(octave: i32) -> i32
Available on crate feature musicxml only.
Expand description

An octave as MusicXML can say it: music21’s moveOctaveIntoMusicxmlRange, new in v11, which moves an octave outside the format’s 0 to 9 to the nearest end of that range rather than writing a number no reader will take.

music21 warns as it moves one; the crate writes no warning, a library having no environment to write to, and what reaches the document is the same number. Three things carry an octave into a document – a pitch, a rest’s displayed place and an unpitched stroke’s – and each goes through this.

use music21::musicxml::musicxml_octave;

assert_eq!(musicxml_octave(4), 4);
assert_eq!(musicxml_octave(12), 9);