Midi-Channel

P
Pete posted Feb 23, 16:42:

How can i change the MIDI-Channel...? The code-line "if messagechannel ==2:" don't work... What is the correct modification in "samplerbox.py" ?

Regards
Pete

P
Pete posted Feb 24, 16:13:

Hello again...

What must be changed in this code below, for using only one midi-channel in Samplerbox...?

def MidiCallback(message, time_stamp):
global playingnotes, sustain, sustainplayingnotes
global preset
messagetype = message[0] >> 4
messagechannel = (message[0] & 15) + 1
note = message[1] if len(message) > 1 else None
midinote = note
velocity = message[2] if len(message) > 2 else None

Kind Regards
Peter

H
HansEhv posted Feb 24, 22:45:

Hi Pete,
You used the correct code-line. Possible pitfalls:
1)
The channel numbering: if you need channel 1 (default=keyboard), the test should be "..==1"; midi sends channel 1-16 as 0-15 in the protocol, hence the "...+ 1" in the code.
2)
Did you indent all statements following it (belonging to this if statement) ?
Python does not have an end-if, the if statements are regocnized by level of indentation, so you need to be precise with that.

...

  (not published)
  I want to post as guest
 

Post