Describe note
note
[note (symbol_or_number)]
Takes a midi note, a symbol (e.g. :C ) or a string (e.g. 'C' ) and resolves it to a midi note. You can also pass an optional :octave parameter to get the midi note for a given octave. Please note - :octave param is overridden if octave is specified in a symbol i.e. :c3
Introduced in v2.0.0
|
# These all return 60 which is the midi number for middle C (octave 4) puts note(60) puts note(:C) puts note(:C4) puts note('C') |
|
|
# returns 60 - octave param has no effect if we pass in a number puts note(60, octave: 2) # These all return 36 which is the midi number for C2 (two octaves below middle C) puts note(:C, octave: 2) puts note(:C4, octave: 2) puts note('C', octave: 2) |
# note the octave param overrides any octaves specified in a symbol |