Mod to assign sample change to Data enconder or any other

Jose Sanchez posted Dec 16 '20, 20:25:

Hi. My MIDIPLUS AKM322 didn't have a Program Change button. So I wanted to use de Data encoder to change the sample set. I am just a newbie at programming so this is not an automatic solution but it is simple to understand.
First of all search for

def MidiCallback(message, time_stamp):

after this line

velocity = message[2] if len(message) > 2 else None

paste this

print 'message type: ' + str(messagetype)
print 'note: ' + str(note)
print 'velocity: ' + str(velocity)

this way, when you run


you will see the values of these parameters for each key or knob or whatever you touch on your midi device.

In my case, the Data encoder generates a Message type 11 and a note 10. The velocity value went from 0 to 127.
By the way, I tested the other three knobs and all them were message type 11, note 21, 22, 23 respectively.

so, I modified again, deleted the lines added before and after this line (at the end of the MidiCallback def)

elif (messagetype == 11) and (note == 64) and (velocity >= 64): # sustain pedal on
sustain = True

I added

elif (messagetype == 11) and (note == 10):
print 'Program Change ' + str(velocity)
preset = velocity

Hope this will be useful!!!!
I speak Spanish, so excuse my English.
to modify the .py file I used

sudo nano

Jose Sanchez posted Dec 16 '20, 20:36:

don't forget the identation after the elif sentence

elif (messagetype == 11) and (note == 10):
print 'Program Change' + str(velocity)
preset = velocity

Jose Sanchez posted Dec 16 '20, 20:37:

well, i dont know hot to type a code here, hehehe. Somebody can help me?


  (not published)
  I want to post as guest