Operator SDK
Build MIDI processing and UI modes for the Operator device
Loading...
Searching...
No Matches
op::sdk::midi Namespace Reference

MIDI note-name formatting and related helpers. More...

Functions

void note_name (uint8_t note, char out[5])
 Write the human-readable name for a MIDI note into out.
uint8_t voice_chord (const uint8_t *input_notes, uint8_t count, int8_t octave_shift, uint8_t *out)
 Copy a chord voicing into out, transposed by octave_shift octaves and clamped to the MIDI range [0, 127].

Variables

constexpr uint8_t kScaleMajor [] = {0, 2, 4, 5, 7, 9, 11}
 Major scale (Ionian).
constexpr uint8_t kScaleNaturalMinor [] = {0, 2, 3, 5, 7, 8, 10}
 Natural minor scale (Aeolian).
constexpr uint8_t kScaleHarmonicMinor [] = {0, 2, 3, 5, 7, 8, 11}
 Harmonic minor scale.
constexpr uint8_t kScaleMelodicMinor [] = {0, 2, 3, 5, 7, 9, 11}
 Melodic minor scale (ascending).
constexpr uint8_t kScaleDorian [] = {0, 2, 3, 5, 7, 9, 10}
 Dorian mode.
constexpr uint8_t kScaleMixolydian [] = {0, 2, 4, 5, 7, 9, 10}
 Mixolydian mode.
constexpr uint8_t kScaleBlues [] = {0, 3, 5, 6, 7, 10}
 Blues (hexatonic) scale.
constexpr uint8_t kScaleWholeTone [] = {0, 2, 4, 6, 8, 10}
 Whole-tone scale.
constexpr uint8_t kScalePentatonicMajor [] = {0, 2, 4, 7, 9}
 Major pentatonic scale.
constexpr uint8_t kScalePentatonicMinor [] = {0, 3, 5, 7, 10}
 Minor pentatonic scale.
constexpr uint8_t kScaleChromatic [] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
 Chromatic (12-tone) scale.
constexpr uint8_t kCCModWheel = 1
 Modulation Wheel (CC 1).
constexpr uint8_t kCCBreath = 2
 Breath controller (CC 2).
constexpr uint8_t kCCFootPedal = 4
 Foot pedal (CC 4).
constexpr uint8_t kCCPortamentoTime = 5
 Portamento Time (CC 5).
constexpr uint8_t kCCDataEntry = 6
 Data Entry MSB (CC 6).
constexpr uint8_t kCCVolume = 7
 Channel Volume (CC 7).
constexpr uint8_t kCCBalance = 8
 Balance (CC 8).
constexpr uint8_t kCCPan = 10
 Pan (CC 10).
constexpr uint8_t kCCExpression = 11
 Expression (CC 11).
constexpr uint8_t kCCEffect1 = 12
 Effect Controller 1 (CC 12).
constexpr uint8_t kCCEffect2 = 13
 Effect Controller 2 (CC 13).
constexpr uint8_t kCCSustain = 64
 Damper / Sustain pedal (CC 64).
constexpr uint8_t kCCPortamento = 65
 Portamento on/off (CC 65).
constexpr uint8_t kCCSostenuto = 66
 Sostenuto (CC 66).
constexpr uint8_t kCCSoftPedal = 67
 Soft pedal (CC 67).
constexpr uint8_t kCCLegato = 68
 Legato footswitch (CC 68).
constexpr uint8_t kCCReset = 121
 Reset all controllers (CC 121).
constexpr uint8_t kCCAllSoundOff = 120
 All Sound Off (CC 120).
constexpr uint8_t kCCAllNotesOff = 123
 All Notes Off (CC 123).
constexpr uint8_t kCCLocalControl = 122
 Local control on/off (CC 122).

Detailed Description

MIDI note-name formatting and related helpers.

Function Documentation

◆ note_name()

void op::sdk::midi::note_name ( uint8_t note,
char out[5] )
inline

Write the human-readable name for a MIDI note into out.

Parameters
noteNote number in [0, 127].
outBuffer of at least 5 bytes. On return holds e.g. "C4" or "F#9" NUL-terminated. Sharps are always used for simplicity.

Octave convention: MIDI note 60 = C4 (so 0 = C-1 in strict MIDI).

◆ voice_chord()

uint8_t op::sdk::midi::voice_chord ( const uint8_t * input_notes,
uint8_t count,
int8_t octave_shift,
uint8_t * out )
inline

Copy a chord voicing into out, transposed by octave_shift octaves and clamped to the MIDI range [0, 127].

Parameters
input_notesSource chord tones (MIDI note numbers).
countNumber of source notes.
octave_shiftSigned number of octaves to transpose (-10..+10 typical).
outDestination array of at least count bytes.
Returns
Number of notes written, which is count unless input_notes or out is null (then 0). Notes that would fall outside [0,127] are clamped rather than dropped.