josephernest / SamplerBox

SamplerBox is a sampler musical instrument based on RaspberryPi.
https://www.samplerbox.org
430 stars 97 forks source link

Midi - Channel - using only one channel in Samplerbox #36

Closed pirat73 closed 5 years ago

pirat73 commented 5 years ago

How can i modify the code below, for using only one midi-channel instead of omni-mode (all channel) input...?

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

josephernest commented 5 years ago

Something like:

if messagechannel != 10:
   return

would filter out all channels except 10. Good luck! Please post on http://samplerbox.org/forum to continue this discussion.