module MTK::Lang::Pitches
Defines a constants for each {Core::Pitch} in the standard MIDI
range using scientific pitch notation. The constants range from C-1 (MIDI
value 0) to G9 (MIDI
value)
Because the character ‘#’ cannot be used in the name of a constant, the “black key” pitches are all named as flats with ‘b’ (for example, Gb3 or Db4). And because the character ‘-’ (minus) cannot be used in the name of a constant, the low pitches use ‘_’ (underscore) in place of ‘-’ (minus) (for example C_1).
To help automate the documentation, the constants are listed under “Instance Attribute Summary” on this page.
@see Core::Pitch
@see Events::Note
@see en.wikipedia.org/wiki/Scientific_pitch_notation
Constants
- PITCHES
The values of all constants defined in this module @note This is populated dynamically so the documentation does not reflect the actual value
- PITCH_NAMES
The names of all constants defined in this module @note This is populated dynamically so the documentation does not reflect the actual value
Public Class Methods
@private @!macro [attach] define_pitch
Pitch $1 (MIDI pitch $2) @!attribute [r] @return [MTK::Core::Pitch] Pitch $1 (value $2)
# File lib/mtk/lang/pitches.rb, line 24 def self.define_pitch name, value pitch = MTK::Core::Pitch.from_i(value) const_set name, pitch PITCHES << pitch PITCH_NAMES << name end