Knob converted to Note

Justin L.

2020-04-22 04:41:05

So lets say I have a knob on a controller, has values from 0-127, obviously.  And I want to convert that knob's value to a note on/off... Specifically that at value 127 it sends a note on value, but any ANY other value 0-126, it will transmit a note off instead.

Is there a way to convert a specific RANGE of values to a note on/off such as this?  Some sort of variable and if-then or less than script?

I am new to BMT and have not quite gotten into the nuts and bolts of the rules and variables of it all yet.

Thanks ahead of time.

Steve-Bome Forum Moderator

2020-04-22 05:28:22

Sure,

Please see the below example.

The rules set the crossover point.

We compare the current input value to the last known input value. We subtract both values from the crossover pont. We do this so that when we multiply them together if they are both on the same side of the crossover point the value is positive and if they are at opposite sides of the crossover point the result is negative.

If the result is negative (we crossed over)  we output a note with velocity of 127 the new value is greater than the old value (note-on) or output velocity of 0 if the new value is less than the old value (note-off)

 

If the result is positive (we did not cross the point) we suppress the output so you don\'t get duplicate note messages.

 

Here are the rules

// cross over point

ss=64

// determine if we crossed

// get last value

rr=ss-ga

 

// get current value

tt=ss-pp

// Multiply to check if we crossed

uu=rr*tt

// If negative then we crossed

tt=0

if uu<=0 then tt=1

 

// EDIT had to move this up from original posting so that ga is always updated for  next iteration Make sure rules in the attached file match this.

ga=pp

// we didn\'t cross, so skip

if tt==0 then exit rules, skip Outgoing Action

 

 

 

qq=127

if pp<ss then qq=0

 

Steve Caldwell
Bome Q and A Moderator and
Independent Bome Consultant/Specialist
bome@sniz.biz

 

 

 

 


Attachments:

CC-to-Note-Sample-2020-04-21.bmtp