Author Topic: MIDI messages question  (Read 4096 times)

chaocrator

  • Team member
  • *
  • Posts: 28
    • View Profile
MIDI messages question
« on: June 12, 2017, 11:24:51 AM »
making a PreenFM2 template for my NRPN-capable hardware MIDI controller, i encountered the following issue.

midi messages manual says:

LFO <n> Shape              MSB = 1   LSB = 40 + n*4       where 1 <= n <= 3

which results: 40+1*4 = 44 for LFO1, 40 + 2*4 = 48 for LFO2, and 40 + 3*4 = 52 for LFO 3
but according to the manual,
Free Env1 Attack           MSB = 1   LSB = 52

same for
LFO <n> Freqency           MSB = 1   LSB = 41 + n*4       where 1 <= n <= 3

results: 41+1*4 = 45 for LFO1, 41 + 2*4 = 49 for LFO2, and 41 + 3*4 = 53 for LFO 3
but according to the manual,
Free Env1 Decay            MSB = 1   LSB = 53

same for
LFO <n> Bias               MSB = 1   LSB = 42 + n*4       where 1 <= n <= 3

results: 42+1*4 = 46 for LFO1, 42 + 2*4 = 50 for LFO2, and 42 + 3*4 = 54 for LFO 3
but according to the manual,
Free Env1 Sustain          MSB = 1   LSB = 54

and same for
LFO <n> Key Sync           MSB = 1   LSB = 43 + n*4       where 1 <= n <= 3

results: 43+1*4 = 47 for LFO1, 43 + 2*4 = 51 for LFO2, and 43 + 3*4 = 55 for LFO 3
but according to the manual,
Free Env1 Release          MSB = 1   LSB = 55

so, the question is: where's the error ?
thanks in advance.

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2256
    • View Profile
Re: MIDI messages question
« Reply #1 on: June 14, 2017, 09:12:32 AM »
Thanks a lot for your message. I fixed the errors.

LFO <n> : NRPN LSB should use (n-1) in the formula instead of n.

Let me know if you find other errors.

Xavier

chaocrator

  • Team member
  • *
  • Posts: 28
    • View Profile
Re: MIDI messages question
« Reply #2 on: June 14, 2017, 10:21:23 AM »
theoretically, no other errors at the moment.
anyway, this week i will test every single parameter input one by one, so i'll let you know if something will not work as expected.

chaocrator

  • Team member
  • *
  • Posts: 28
    • View Profile
Re: MIDI messages question
« Reply #3 on: June 16, 2017, 01:40:45 PM »
yet another question is how the values of parameters like IM or A, D, S, R are actually calculated.
i'm trying to understand whether i should send those values as 7-bit or as 14-bit.

Xavier

  • Administrator
  • Hero Member
  • *
  • Posts: 2256
    • View Profile
Re: MIDI messages question
« Reply #4 on: June 21, 2017, 09:14:15 PM »

For all NRPN floating point params : the forumla is :
Code: [Select]
            valueToSend = (floatValue - param->minValue) * 100.0f + .1f ; // minValue if the minimal value authorized for the param (-1.0; 0.0...).
            cc.value[0] = 6;
            cc.value[1] = (unsigned char) (valueToSend >> 7);
            sendMidiCCOut(&cc, false);
            cc.value[0] = 38;
            cc.value[1] = (unsigned char) (valueToSend & 127);
            sendMidiCCOut(&cc, false);

IF the minimal value of the param is 0.0 which is the case for ADSR.
The NRPN 14 bits value is the time in 1/100th of seconds.

If you use CC you cannot send all values :
https://github.com/Ixox/preenfm2/blob/master/src/midi/MidiDecoder.cpp#L477
The param will be value/64 in sec for A, and /32 for R.

Xavier


chaocrator

  • Team member
  • *
  • Posts: 28
    • View Profile
Re: MIDI messages question
« Reply #5 on: June 26, 2017, 02:50:53 PM »
thanks for the answer.

If you use CC you cannot send all values
that's why i preferred NRPNs from the start, since my controller (Novation ReMOTE Zero SL) is capable of handling them.