Skip to main content

Note

Struct Note 

Source
pub struct Note {
Show 50 fields pub id: String, pub is_rest: bool, pub is_unpitched: bool, pub instrument_id: Option<String>, pub offset_x: Option<f64>, pub offset_y: Option<f64>, pub relative_x: Option<f64>, pub relative_y: Option<f64>, pub pitches: Vec<Pitch>, pub tab_position: Option<TabPosition>, pub tab_positions: Vec<TabPosition>, pub duration: Duration, pub dot_count: u8, pub tie_start: bool, pub tie_end: bool, pub pitch_tie_starts: Vec<bool>, pub pitch_tie_ends: Vec<bool>, pub beam: BeamState, pub articulations: Vec<Articulation>, pub dynamic: Option<Dynamic>, pub stem_up: Option<bool>, pub hairpin_start: Option<HairpinKind>, pub hairpin_end: bool, pub tuplet: Option<TupletInfo>, pub chord_symbol: Option<ChordSymbol>, pub is_grace: bool, pub grace_slash: bool, pub ottava_start: Option<OttavaKind>, pub ottava_end: bool, pub lyric: Option<Lyric>, pub additional_lyrics: Vec<VerseLyric>, pub pedal_start: bool, pub pedal_end: bool, pub slur_start: bool, pub slur_end: bool, pub arpeggiate: Option<bool>, pub technique_text: Option<String>, pub glissando_start: bool, pub glissando_end: bool, pub cross_staff: Option<CrossStaff>, pub fingering: Option<u8>, pub fingerings: Vec<u8>, pub string_number: Option<u8>, pub note_head: NoteHead, pub is_cue: bool, pub trill_line_start: bool, pub trill_line_end: bool, pub guitar_technique: Option<GuitarTechnique>, pub guitar_bend_alter_cents: Option<i16>, pub guitar_bend_curve: Vec<GuitarBendPoint>,
}

Fields§

§id: String§is_rest: bool§is_unpitched: bool

MusicXML unpitched note; pitches then stores display placement only.

§instrument_id: Option<String>

Optional source instrument identifier (for example MusicXML note-level instrument@id).

§offset_x: Option<f64>

Horizontal nudge in tenths from the note’s computed (rhythmic) position, set by hosts. MusicXML import does not fill it from default-x, which is an absolute position in the source engraver’s layout; MusicXML export writes it as part of relative-x.

§offset_y: Option<f64>

Vertical nudge in tenths from the note’s staff position; see offset_x.

§relative_x: Option<f64>

MusicXML note-level horizontal adjustment in tenths.

§relative_y: Option<f64>

MusicXML note-level vertical adjustment in tenths.

§pitches: Vec<Pitch>

Single note: one pitch. Chord: multiple pitches (same duration).

§tab_position: Option<TabPosition>§tab_positions: Vec<TabPosition>

One tablature position per pitch; the first entry mirrors tab_position. This is populated for chords so each pitch can occupy a distinct string.

§duration: Duration§dot_count: u8§tie_start: bool§tie_end: bool§pitch_tie_starts: Vec<bool>

Per-pitch tie starts, parallel to pitches, for a chord whose notes are not all tied. Empty (the usual case) means tie_start applies to every pitch. A vector whose length differs from pitches is ignored in favour of tie_start; see Note::pitch_tie_start.

§pitch_tie_ends: Vec<bool>

Per-pitch tie ends, parallel to pitches; empty means tie_end applies to every pitch.

§beam: BeamState§articulations: Vec<Articulation>§dynamic: Option<Dynamic>§stem_up: Option<bool>§hairpin_start: Option<HairpinKind>§hairpin_end: bool§tuplet: Option<TupletInfo>§chord_symbol: Option<ChordSymbol>§is_grace: bool§grace_slash: bool

Acciaccatura: true (slash through stem). Appoggiatura: false.

§ottava_start: Option<OttavaKind>§ottava_end: bool§lyric: Option<Lyric>§additional_lyrics: Vec<VerseLyric>

Lyrics for verse 2 and later, in ascending verse order; verse 1 is lyric.

§pedal_start: bool§pedal_end: bool§slur_start: bool§slur_end: bool§arpeggiate: Option<bool>

Arpeggiate direction: Some(true) = up, Some(false) = down, None = none.

§technique_text: Option<String>

Technique/style instruction attached to this note (“pizz.”, “arco”, “con sord.”, etc.).

§glissando_start: bool§glissando_end: bool§cross_staff: Option<CrossStaff>§fingering: Option<u8>

Left-hand fingering number (0 = open / thumb, 1–5 = fingers).

§fingerings: Vec<u8>

Alternate left-hand fingering candidates, in source order. The first entry mirrors fingering when present.

§string_number: Option<u8>

String number for plucked/bowed string instruments (1 = highest string).

§note_head: NoteHead§is_cue: bool

Cue note (small-sized, does not count toward beat total).

§trill_line_start: bool

Start of a multi-note trill line span.

§trill_line_end: bool

End of a multi-note trill line span.

§guitar_technique: Option<GuitarTechnique>

Guitar-specific playing technique (bend, slide, hammer-on, pull-off).

§guitar_bend_alter_cents: Option<i16>

MusicXML bend amount in cents when supplied by the source.

§guitar_bend_curve: Vec<GuitarBendPoint>

Ordered bend curve points. Position is relative note time in per-mille (0..=1000).

Implementations§

Source§

impl Note

Source

pub fn select_fingering(&self, policy: FingeringSelectionPolicy) -> Option<u8>

Select one authored fingering candidate without changing the score.

Source

pub fn new(pitch: Pitch, duration: Duration) -> Self

Source

pub fn rest(duration: Duration) -> Self

Source

pub fn repeated_copy(&self) -> Note

Copy for a repeated measure: a fresh id and the same sounding content, without ties, slurs, lines, lyrics, chord symbol, or dynamic, which belong to the written original.

Source

pub fn pitch_tie_start(&self, index: usize) -> bool

Whether the pitch at index starts a tie: its own flag when per-pitch ties are recorded, otherwise the chord-level tie_start.

Source

pub fn pitch_tie_end(&self, index: usize) -> bool

Whether the pitch at index ends a tie; see Note::pitch_tie_start.

Source

pub fn set_pitch_ties(&mut self, starts: &[bool], ends: &[bool])

Record which pitches of this note start (starts) and end (ends) a tie. The chord-level flags become “any pitch”, and per-pitch vectors are kept only when the pitches differ, so a uniformly tied chord stays in the plain form. Slices whose length is not the pitch count are ignored.

Source

pub fn pitch_tie_starts_or_uniform(&self) -> Vec<bool>

Per-pitch tie starts as a full vector (chord-level flag repeated when not recorded).

Source

pub fn pitch_tie_ends_or_uniform(&self) -> Vec<bool>

Per-pitch tie ends as a full vector (chord-level flag repeated when not recorded).

Source

pub fn is_plain_whole_rest(&self) -> bool

A plain whole rest, the form MusicXML <rest measure="yes"/> and MuseScore durationType=measure import to. Alone in a voice it is a measure rest; see voice_duration_beats.

Source

pub fn beats(&self) -> f64

Trait Implementations§

Source§

impl Clone for Note

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Note

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Note

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnsafeUnpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.