QuNeoMIDI2CV

Monophonic MIDI keyboard note input, gate, velocity and release velocity to use with the QuNeo midicontroller. The module sorts out the 2 extra X/Y midicontrols that are send with each note and outputs these a 2 extra polyphonic controls next to the pressure output.
Author: Remco van der Most
License: BSD
Github: sss/midi/QuNeoMIDI2CV.axo

Inlets

None

Outlets

frac32.bipolar midi note number (-64..63)

bool32 key pressed, no retrigger legato

bool32 key pressed, retrigger on legato

frac32.positive note-on velocity

frac32.positive note-off velocity

frac32 pressure

frac32 CV1

frac32 CV2

int32 polyindex

Declaration
int8_t _note;
int32_t _gate;
int32_t _gate2;
uint8_t _velo;
uint8_t _rvelo;
int32_t ccv0[128];
int32_t ccv1[128];
int32_t ccv2[128];
int8_t _tmp;
Init
_gate = 0;
_note = 0;
Control Rate
outlet_note = _note << 21;
outlet_gate = _gate;
outlet_gate2 = _gate2;
_gate2 = _gate;
outlet_velocity = _velo << 20;
outlet_releaseVelocity = _rvelo << 20;
outlet_pressure = ccv0[_tmp];
outlet_CV1 = ccv1[_tmp + 1];
outlet_CV2 = ccv2[_tmp + 2];
outlet_polyindex = parent->polyIndex;
Midi Handler
if ((status == MIDI_NOTE_ON + attr_midichannel) && (data2)) {
  _velo = data2;
  _note = data1 - 64;
  _gate = 1 << 27;
  _gate2 = 0;
  //_tmp=((data1-36)&15)*3;
  _tmp = (data1 - 36);
  _tmp = (_tmp - _tmp / 16 * 16) * 3;
} else if (((status == MIDI_NOTE_ON + attr_midichannel) && (!data2)) ||
           (status == MIDI_NOTE_OFF + attr_midichannel)) {
  if (_note == data1 - 64) {
    _rvelo = data2;
    _gate = 0;
  }
} else if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
           (data1 == MIDI_C_ALL_NOTES_OFF)) {
  _gate = 0;
}

if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
    (data1 == (_tmp + 23)) && (_gate)) {
  ccv0[_tmp] = data2 << 20;
}
if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
    (data1 == (_tmp + 24)) && (_gate)) {
  ccv1[_tmp + 1] = data2 << 20;
}
if ((status == attr_midichannel + MIDI_CONTROL_CHANGE) &&
    (data1 == (_tmp + 25)) && (_gate)) {
  ccv2[_tmp + 2] = data2 << 20;
}

Privacy

© 2024 Zrna Research