pub struct TimeSignature<'a>(/* private fields */);Expand description
FF 58 04 nn dd cc bb Time Signature
The time signature is expressed as four numbers. nn and dd represent the numerator and denominator of the time signature as it would be notated. The denominator is a negative power of two: 2 represents a quarter-note, 3 represents an eighth-note, etc. The cc parameter expresses the number of MIDI clocks in a metronome click. The bb parameter expresses the number of notated 32nd-notes in a MIDI quarter-note (24 MIDI clocks). This was added because there are already multiple programs which allow a user to specify that what MIDI thinks of as a quarter-note (24 clocks) is to be notated as, or related to in terms of, something else.
Therefore, the complete event for 6/8 time, where the metronome clicks every three eighth-notes, but there are 24 clocks per quarter-note, 72 to the bar, would be (in hex):
FF 58 04 06 03 24 08
That is, 6/8 time (8 is 2 to the 3rd power, so this is 06 03), 36 MIDI clocks per dotted-quarter (24 hex!), and eight notated 32nd-notes per quarter-note.
Implementations§
Source§impl<'a> TimeSignature<'a>
impl<'a> TimeSignature<'a>
Sourcepub fn new_from_parts(
numerator: u8,
denominator: u8,
clocks_per_quarter: u8,
notes_per_clocks: u8,
) -> Self
pub fn new_from_parts( numerator: u8, denominator: u8, clocks_per_quarter: u8, notes_per_clocks: u8, ) -> Self
4 bytes; 6/8 time; 24 MIDI clocks/click, 8 32nd notes/ 24 MIDI clocks (24 MIDI clocks = 1 crotchet = 1 beat) is represented by
let x = TimeSignature::new_from_parts(6, 8, 24, 8);Sourcepub fn new_from_bytes(v: BytesConst<'a, 4>) -> Self
pub fn new_from_bytes(v: BytesConst<'a, 4>) -> Self
Interpret a byte slice as a time signature
Sourcepub fn den(&self) -> u8
pub fn den(&self) -> u8
A negative power of two.
if this returns 3, then 2^3 = 8, so it’s representative of an eigth
Sourcepub fn clocks_per_click(&self) -> u8
pub fn clocks_per_click(&self) -> u8
midi clocks in a metronome click
Sourcepub fn notated_32nds_per_24_clocks(&self) -> u8
pub fn notated_32nds_per_24_clocks(&self) -> u8
(24 MIDI clocks = 1 crotchet = 1 beat). 24 midi clocks is a MIDI quarter note
Trait Implementations§
Source§impl<'a> Clone for TimeSignature<'a>
impl<'a> Clone for TimeSignature<'a>
Source§fn clone(&self) -> TimeSignature<'a>
fn clone(&self) -> TimeSignature<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for TimeSignature<'a>
impl<'a> Debug for TimeSignature<'a>
Source§impl Default for TimeSignature<'_>
impl Default for TimeSignature<'_>
Source§impl<'a> Hash for TimeSignature<'a>
impl<'a> Hash for TimeSignature<'a>
Source§impl<'a> PartialEq for TimeSignature<'a>
impl<'a> PartialEq for TimeSignature<'a>
Source§fn eq(&self, other: &TimeSignature<'a>) -> bool
fn eq(&self, other: &TimeSignature<'a>) -> bool
self and other values to be equal, and is used by ==.