|
Post by synthi on Jun 3, 2020 22:15:10 GMT
Its possible to convert MIDI note numbers to velocity values?? I mean, ie. C3 (midi note 60) to be velocity 60 ignoring the velocity from the keyboard or controller?
Why??
OK I own an Dreadbox Abyss synth, and it lacks filter tracking, but it have the option for controlling the filter frequency from velocity... that way I could mimic the behaviour of the filter tracking by keyboard...
Thanks!
|
|
nic
Soapbox Supremo  
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 4, 2020 15:58:10 GMT
Hi synthi , 9X = XX XX X2would pin any note's velocity to its note number Regards, Nic.
|
|
|
Post by synthi on Jun 5, 2020 4:13:59 GMT
Thanks a lot Nic! Working great!!! Now I just wish I could stretch the range, let’s say notes 0 - 127 to velocities 30-100 or other ranges, trying to find better tracking.
edit: it’s the opposite! I’ll need the full range in less keys, so, f.e. C1 will be 0 (and the previous notes too) and C6 will be 127 ( and upper notes. Ideally would be better a true stretch with a curve that puts the majority of the values in the “middle”.
Also I’d like to know how is working the script.... why 9X? I thought NX is for notes...? Also what represent velocities? I read the manual but can’t find a “list” Like: N=notes, C=controllers(?j, L=..... Also why three groups of XX before the “=“. Sorry for the newbie questions but I really want to understand what’s behind the script... and yes, I know anything about Programming.
thanks again!
|
|
nic
Soapbox Supremo  
Troublemaker
Press any key to continue
Posts: 2,011
|
Post by nic on Jun 6, 2020 10:56:03 GMT
Hi synthi , It is of course possible to write scaling code, but I will answer your latter questions before I get into that. It really helps to understand MIDI messages - in this case, the note messages (I recommend Somascape MIDI Guide for understanding MIDI) When you hold down a note, a note on message arrives with the note number and its velocity. These messages start with '9' in StreamByter (hex) parlance. When a note is released, a note off is sent, and these begin with '8'. For what you want to do, we are only interested in the events that start with '9'. In StreamByter we can use the letter 'N' to match both note on and note off events (but we're not doing that here) The raw note on message looks something like this: 90 3C 40 (note on, channel 1, middle C, velocity = 64)So the rule I gave you works on the above messages (3 bytes of data starting with a 9) and then copies the second byte (3C in the example above) over the top of the 3rd byte (40 in the example above) so the outgoing example message above gets rewritten to: 90 3C 3CThat's the basics of it. It might be worth taking a look at StreamByter University to learn about writing StreamByter code. Now, if instead of just copying the note number to the velocity, you want to do some sort of scaling we need to write maths code. Something like: if load # range of notes to scale velocity assign L0 = ^C1 ^C6 assign L2 = L1 - L2 # calc range width end if MT = 90 # is this a note message starting with '9'? # scale the velocity (M2) based on note number (M1) assign M2 = 0 # (assume zero velocity) if M1 > L0 if M1 > L1 # dodgy scaling maths calc I0 = M1 - L0 calc I0 = I0 * $127 calc M2 = I0 / L2 end end endThe other way of doing it is with a note number to velocity lookup table which is covered in the manual and tutorial (I think). There are only 128 notes, so it's do-able, especially if most are 0. That way you can specify a curve. (I guess you could use MidiFire's pressure curve too for this) Regards, Nic.
|
|
|
Post by synthi on Jun 7, 2020 6:48:37 GMT
Awesome! Thanks a lot Nic!!!
|
|