pub enum Clef {
}Variants§
Treble
Bass
Alto
Tenor
Percussion
Treble8vb
Treble clef with an 8 below: sounds an octave lower (tenor voice, guitar).
Treble8va
Treble clef with an 8 above: sounds an octave higher.
Bass8vb
Bass clef with an 8 below: sounds an octave lower (contrabass, bass guitar).
Bass8va
Bass clef with an 8 above: sounds an octave higher.
Soprano
C clef on the bottom line.
MezzoSoprano
C clef on the second line.
Baritone
C clef on the top line.
AbcMiddle
An ABC 2.1 clef whose middle staff line is explicitly mapped to a written pitch.
ABC’s middle= modifier changes staff placement only. It does not transpose the
written pitch or playback, so the original ABC pitch remains intact.
Implementations§
Source§impl Clef
impl Clef
pub fn to_musicxml_sign(&self) -> &'static str
pub fn musicxml_line(&self) -> u8
Sourcepub fn octave_change(&self) -> i8
pub fn octave_change(&self) -> i8
Octaves the music sounds above (+) or below (−) the written notes: the small 8 on the
clef (MusicXML <clef-octave-change>, MEI @clef.dis/@dis.place).
Sourcepub fn without_octave(&self) -> Clef
pub fn without_octave(&self) -> Clef
The clef without its octave mark.
Sourcepub fn with_abc_middle(base: Clef, middle: Pitch) -> Option<Clef>
pub fn with_abc_middle(base: Clef, middle: Pitch) -> Option<Clef>
Attach ABC 2.1’s visual middle= placement to a conventional clef.
Nested custom placements and percussion clefs have no unambiguous ABC meaning and are
rejected by returning None.
Sourcepub fn abc_middle(&self) -> Option<&Pitch>
pub fn abc_middle(&self) -> Option<&Pitch>
The pitch explicitly placed on the middle line by ABC’s middle= modifier.
Sourcepub fn from_sign(
sign: &str,
line: Option<u8>,
octave_change: i8,
) -> Option<Clef>
pub fn from_sign( sign: &str, line: Option<u8>, octave_change: i8, ) -> Option<Clef>
The clef for a sign (G, F, C, percussion), a staff line (1 = bottom) and an
octave change (±1), as MusicXML, MEI and MuseScore describe clefs. None for
combinations the model does not have (French violin clef, a 15ma clef, sub-bass clef).
Sourcepub fn from_name(name: &str) -> Option<Clef>
pub fn from_name(name: &str) -> Option<Clef>
The clef named as in score JSON ("Treble", "Treble8vb", "MezzoSoprano", …).
Sourcepub fn middle_line_midi(&self) -> u8
pub fn middle_line_midi(&self) -> u8
MIDI note number of the middle staff line (used for stem direction heuristics).