Expand description
Pitch classes, spelling for display and the three middle-C labels.
Inside the tool a pitch is a MIDI number and a pitch class an integer
from 0 (C) to 11 (B). Names are for display only. MIDI fixes note 60 as
middle C but names no octave, so programs label it C3, C4 or C5; an
OctaveLabel names each convention by that label.
use sound_to_patch::music::pitch::{OctaveLabel, Spelling, note_name, parse_note};
assert_eq!(note_name(60, OctaveLabel::C4, Spelling::Sharps), "C4");
assert_eq!(note_name(60, OctaveLabel::C3, Spelling::Sharps), "C3");
assert_eq!(parse_note("A-1", OctaveLabel::C3)?, 21);Structs§
- Note
Reading - A note name read without a stated convention.
Enums§
- Octave
Label - A convention for octave numbers, named by the label it gives note 60.
- Spelling
- Whether a name uses sharps or flats.
Functions§
- class_
name - The name of a pitch class.
- note_
name - The name of a MIDI pitch in a convention, such as
C4orA-1. - parse_
note - The MIDI pitch of a note name in a convention: a letter, up to two
sharps or flats and an octave number, such as
C4,F#2orA-1. - pitch_
class - The pitch class of a MIDI number.
- read_
note - Reads a note name when the producer names no convention.