Skip to main content

spanner_parameters

Function spanner_parameters 

Source
pub fn spanner_parameters(
    spanner: &Spanner,
    end: SpannerEnd,
) -> Vec<(&'static str, SpannerParameter)>
Available on crate feature musicxml only.
Expand description

music21’s _spannerStartParameters and _spannerEndParameters: the attributes an octave line, a bracket line, a hairpin or a pedal mark writes where it starts or stops. Every other spanner has only its type.

An 8va starts down: the notes are engraved below where they sound. A crescendo opens from nothing and a diminuendo closes to nothing. MusicXML has no start for any pedal but the sustaining and sostenuto ones, so music21 writes the soft and silent pedals as a plain start.

use music21::{Spanner, SpannerKind};
use music21::musicxml::{SpannerEnd, SpannerParameter, spanner_parameters};

let crescendo = Spanner::new(SpannerKind::Crescendo, vec![0, 1]);
let start = spanner_parameters(&crescendo, SpannerEnd::Start);
assert!(start.contains(&("type", SpannerParameter::Text("crescendo"))));
assert!(start.contains(&("spread", SpannerParameter::Whole(0))));