Expand description
Ornaments recognized from the notes they are played as: music21’s
alpha.analysis.ornamentRecognizer.
The notes an ornament is played as are its busy notes; the note it is written on, where one is given, is its simple note. A recognizer answers the ornament the busy notes play, or nothing where they play none.
use music21_rs::alpha::analysis::ornament_recognizer::TrillRecognizer;
use music21_rs::expressions::OrnamentKind;
use music21_rs::{Duration, Note, StreamElement};
let played: Vec<StreamElement> = ["G4", "A4", "G4", "A4"]
.iter()
.map(|name| Ok(Note::from_name(name)?.with_duration(Duration::new(0.25)?).into()))
.collect::<music21_rs::Result<_>>()?;
let trill = TrillRecognizer::default().recognize(&played, &[])?.expect("a trill");
assert_eq!(trill.kind(), OrnamentKind::Trill);
assert_eq!(trill.quarter_length(), 0.25);Structs§
- Trill
Recognizer - Recognizes busy notes as a trill: music21’s
TrillRecognizer. - Turn
Recognizer - Recognizes busy notes as a turn: music21’s
TurnRecognizer.
Functions§
- ornament_
note_ quarter_ length - How long each ornamental note lasts, the busy notes taken as one
ornament: music21’s
calculateOrnamentNoteQl. - ornament_
total_ quarter_ length - How long all the busy notes last together: the first simple note’s
length where one is given, else the busy notes’ lengths added up.
music21’s
calculateOrnamentTotalQl.