int32 pitch
int32 scale
int32 key
frac32 note
int note[12] = {0, 0, 2, 2, 4, 5, 5, 7, 7, 9, 9, 11};
int key = inlet_key - 4;
key = key - (key / 12) * 12;
key = key < 0 ? key + 12 : key;
int Scale = inlet_scale;
Scale = Scale - (Scale / 46) * 46;
Scale = Scale < 0 ? Scale + 46 : Scale;
int octave = inlet_pitch / 12 - (inlet_pitch < 0 ? 1 : 0);
int semitone = inlet_pitch - octave * 12;
outlet_note = (note[semitone + Scale * 12] + octave * 12 + key) << 21;