First time here? Check out the FAQ!
x

How can I detect multiple note on messages from a midi controller that doesn't send note offs?

0 votes
460 views

I have a midi controller that sends out several midi note on messages to indicate mode. Eg. 

 

  • nn 0 is mode 0
  • nn 11 is mode 1
  • nn 14 is mode 2
  • nn 24 is mode 3

 

and then it cycles round again. 

 

The thing is it never sends any note off messages for these mode changes. 

 

I used this expression in an STGC to get the mode:

 

| mode |

mode := EventVariable new initialValue: 0.

((!KeyNumber eq: 0) \/ 

(!KeyNumber eq: 11) \/ 

(!KeyNumber eq: 14) \/

(!KeyNumber eq: 24)) true: (

    mode <~ (!KeyNumber into: #({0 @ 0} {11 @ 1} {14 @ 2} {24 @ 3}))

) false: (

    mode

)

 

 

but it only works the first time each mode is entered. I guess because it doesn't get a note off message that note never retriggers. How can I create a !Mode event value that will change with these midi messages?

asked Nov 27, 2019 in Capytalk & Smalltalk by alan-jackson (Virtuoso) (15,840 points)

1 Answer

0 votes

The value of !KeyNumber is sampleAndHeld on !KeyDown so the value changes even without a noteOff. The following expression should be equal to Mode:

!KeyNumber  indexOfValueIn: #(0 11 14 24) 

* the initial value of !KeyNumber is 60, but once it receives a keynumber from your controller it should take on the value of Mode.

answered Nov 27, 2019 by ssc (Savant) (127,060 points)
...