The MIDI pitch; rounded to the nearest integer.
The spelled tonic of the key, as a note name, a MIDI number,
note data, or a Note.
The key/scale, as a key name, a key/scale, or a Key.
Optionalcontext: SpellingContext
Optional surrounding evidence, weighed exactly as spellPitchClass weighs it.
The spelled note, carrying the octave that reproduces pitch.
Spell a MIDI pitch relative to a key, keeping its octave.
The octave-less sibling of this function, spellPitchClass, is enough for chord and scale spelling; this one is for naming actual sounding pitches (a generated line, an imported track) without losing the register.
The octave is the one that reproduces
pitchfrom the chosen spelling, so a context that changes the letter changes the octave with it: MIDI 60 spelled B# is B#3, not B#4.