Skip to main content

Articulation

Struct Articulation 

Source
pub struct Articulation { /* private fields */ }
Expand description

An articulation: how a note is played, and the numbers that say it.

Two articulations are equal when they are of one kind, as music21’s are; where they sit and what else they say does not count.

use music21_rs::articulations::{Articulation, ArticulationKind};

let accent = Articulation::of_kind(ArticulationKind::StrongAccent);
assert_eq!(accent.name(), "strong accent");
assert!(accent.volume_shift() > 0.1);
assert!(accent.is_a("Accent"));

Implementations§

Source§

impl Articulation

Source

pub fn of_kind(kind: ArticulationKind) -> Self

An articulation as music21’s class for kind starts out.

Source

pub fn kind(&self) -> ArticulationKind

The kind of articulation this started as.

Source

pub fn is_a(&self, class: &str) -> bool

Whether this is an articulation of that music21 class or one below it: is_a("Staccato") holds for a spiccato.

Source

pub fn name(&self) -> String

music21’s name: the class name as lower-case words, so a snap pizzicato is "snap pizzicato".

Source

pub fn placement(&self) -> Option<&str>

Where the mark sits: "above", "below", or nothing said.

Source

pub fn set_placement(&mut self, placement: Option<String>)

Says where the mark sits.

Source

pub fn volume_shift(&self) -> FloatType

How much the mark shifts the note’s volume, between -1 and 1: music21’s volumeShift, which crate::Volume::realized_with adds.

Source

pub fn set_volume_shift(&mut self, shift: FloatType)

Changes the volume shift, held between -1 and 1.

Source

pub fn length_shift(&self) -> FloatType

What the note’s sounding length is multiplied by: music21’s lengthShift, 0.7 for a staccato.

Source

pub fn set_length_shift(&mut self, shift: FloatType)

Changes the length shift.

Source

pub fn tie_attach(&self) -> &str

Which part of a note split across a tie keeps the mark: music21’s tieAttach, "first", "last" or "all".

Source

pub fn set_tie_attach(&mut self, attach: impl Into<String>)

Changes which part keeps the mark.

Source

pub fn display_text(&self) -> Option<&str>

Text written for the mark instead of its usual sign.

Source

pub fn set_display_text(&mut self, text: Option<String>)

Changes the text written for the mark.

Source

pub fn finger(&self) -> Option<&Finger>

A fingering’s finger: music21’s fingerNumber.

Source

pub fn set_finger(&mut self, finger: Option<Finger>)

Changes the finger.

Source

pub fn substitution(&self) -> bool

Whether a fingering or organ mark is a substitution.

Source

pub fn set_substitution(&mut self, substitution: bool)

Says whether it is a substitution.

Source

pub fn alternate(&self) -> bool

Whether a fingering is an alternate one.

Source

pub fn set_alternate(&mut self, alternate: bool)

Says whether it is an alternate.

Source

pub fn number(&self) -> IntegerType

A string or fret indication’s number: music21’s number, nought when none is given.

Source

pub fn set_number(&mut self, number: IntegerType)

Changes the string or fret number.

Source

pub fn point_direction(&self) -> Option<&str>

Which way a strong accent points: music21’s pointDirection.

Source

pub fn set_point_direction(&mut self, direction: Option<String>)

Changes which way it points.

Source

pub fn symbol(&self) -> Option<&str>

A breath mark’s symbol.

Source

pub fn set_symbol(&mut self, symbol: Option<String>)

Changes the breath mark’s symbol.

Source

pub fn harmonic_type(&self) -> Option<&str>

A string harmonic’s type: "natural" unless said otherwise.

Source

pub fn set_harmonic_type(&mut self, harmonic_type: Option<String>)

Changes the harmonic’s type.

Source

pub fn pitch_type(&self) -> Option<&str>

Which pitch a string harmonic’s written note stands for.

Source

pub fn set_pitch_type(&mut self, pitch_type: Option<String>)

Changes which pitch the written note stands for.

Source

pub fn bend_alter(&self) -> Option<&ChromaticInterval>

How far a fret bend bends the string: music21’s bendAlter.

Source

pub fn set_bend_alter(&mut self, alter: Option<ChromaticInterval>)

Changes how far the string is bent.

Source

pub fn pre_bend(&self) -> bool

Whether the string is bent before the note sounds.

Source

pub fn set_pre_bend(&mut self, pre_bend: bool)

Says whether the string is bent beforehand.

Source

pub fn release(&self) -> Option<FloatType>

When the bend is released, in quarter lengths from the start of the note.

Source

pub fn set_release(&mut self, release: Option<FloatType>)

Changes when the bend is released.

Source

pub fn with_bar(&self) -> Option<&str>

The whammy-bar movement a bend uses: "scoop" or "dip".

Source

pub fn set_with_bar(&mut self, with_bar: Option<String>)

Changes the whammy-bar movement.

Trait Implementations§

Source§

impl Clone for Articulation

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 Articulation

Source§

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

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

impl Default for Articulation

Source§

fn default() -> Self

music21’s bare Articulation.

Source§

impl<'de> Deserialize<'de> for Articulation

Available on crate feature serde only.
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 PartialEq for Articulation

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Articulation

Available on crate feature serde only.
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§

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.