Skip to main content

make_notation

Function make_notation 

Source
pub fn make_notation(stream: &Stream) -> Result<Stream>
Available on crate feature musicxml only.
Expand description

A copy of a stream, or of an element put in one, with the notation it leaves unsaid worked out, as ExportOptions::make_notation works it out before writing: music21’s GeneralObjectExporter.fromGeneralObject and the score’s makeNotation. What comes back is a score.

use music21::{Duration, Note, Stream, StreamKind};
use music21::musicxml::make_notation;

let mut part = Stream::with_kind(StreamKind::Part);
part.push(Note::from_name("C4")?.with_duration(Duration::new(8.0)?));
let score = make_notation(&part)?;
assert_eq!(score.kind(), StreamKind::Score);
assert_eq!(score.parts()[0].measures().len(), 2);

§Errors

A kind of stream music21 writes no score of, and what making the notation refuses.