pub struct PercussionChord { /* private fields */ }Expand description
Several strokes at once, as a hi-hat over a bass drum: music21’s
percussion.PercussionChord.
It is not a harmony and answers none of a chord’s harmonic questions; its members stay in the order given.
use music21_rs::percussion::{PercussionChord, PercussionNote, Unpitched};
use music21_rs::Note;
let chord = PercussionChord::new(vec![
Unpitched::from_display_name("E3")?.into(),
Note::from_name("G4")?.into(),
])?;
assert_eq!(chord.len(), 2);
assert!(chord.is_unpitched(0) && !chord.is_unpitched(1));
assert_eq!(chord.pitches().len(), 1);Implementations§
Source§impl PercussionChord
impl PercussionChord
Sourcepub fn new(members: Vec<PercussionNote>) -> Result<Self>
pub fn new(members: Vec<PercussionNote>) -> Result<Self>
A chord of these members, in this order.
Sourcepub fn is_unpitched(&self, index: usize) -> bool
pub fn is_unpitched(&self, index: usize) -> bool
Whether the member at this place has no pitch.
Sourcepub fn members(&self) -> Vec<PercussionNote>
pub fn members(&self) -> Vec<PercussionNote>
The members, in order.
Sourcepub fn pitches(&self) -> Vec<Pitch>
pub fn pitches(&self) -> Vec<Pitch>
The pitches of the members that have one: music21’s pitches.
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
The same chord lasting this long.
Sourcepub fn written(&self) -> &Chord
pub fn written(&self) -> &Chord
Everything written about the chord as a whole – its length, stem, beams, expressions – and about each member, as a chord of notes standing where the members are displayed. It is a carrier of notation: its harmony means nothing.
Sourcepub fn written_mut(&mut self) -> &mut Chord
pub fn written_mut(&mut self) -> &mut Chord
What is written about the chord, for editing. Adding or removing notes here is not supported: build a new chord instead.
Trait Implementations§
Source§impl Clone for PercussionChord
impl Clone for PercussionChord
Source§impl Debug for PercussionChord
impl Debug for PercussionChord
Source§impl<'de> Deserialize<'de> for PercussionChord
Available on crate feature serde only.
impl<'de> Deserialize<'de> for PercussionChord
Available on crate feature
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 From<PercussionChord> for StreamElement
impl From<PercussionChord> for StreamElement
Source§fn from(value: PercussionChord) -> Self
fn from(value: PercussionChord) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for PercussionChord
impl RefUnwindSafe for PercussionChord
impl Send for PercussionChord
impl Sync for PercussionChord
impl Unpin for PercussionChord
impl UnsafeUnpin for PercussionChord
impl UnwindSafe for PercussionChord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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