Start a new topic

Erae Sysex to MPE using Python, OSC and Max [Solution]

For anyone else wanting to use an API zone and convert the raw sysex data to MPE, here's a solution that worked for me.


1.  Download the Erae Python API example code and install  python-osc

https://gitlab.com/embodme/erae_api_sysex

https://pypi.org/project/python-osc/


2. Use a dictionary in Python to store  "finger id" : "midi channel" pairs.  


 

midi_ch = # initial midi channel

id_channels = {} # dictionary storing a midi channel value for each finger id key


add something like this code to the function receive_midi_message

 


 

if finger_id in id_channels:
      MIDI_CHAN = id_channels.get(finger_id)

else:

      #new id

      id_channels[finger_id] = midi_ch

      midi_ch += 1

      if midi_ch > 9 # choose a maximum midi channel

            midi_ch = 2

      MIDI_CHAN = id_channels.get(finger_id)


3. Send an osc message with the finger id, xyz data, action and midi channel as one string to Max. Then in Max, unpack the message and use xctlout, midiformat and mpeformat to send MPE data to your DAW.


Attached is the example code for this.


erae_sysex-midi.py - replaces run_erae_api.py, removes the prompt to select the midi device as it's always 'Erae 2 MIDI'

 


erae_api_sysex.py - updated receive_midi_message function which stores finger id : midi channel assignments, send osc message to Max


erae.sysex-midi.maxpat  / sysex-midi.maxpat - - receive osc messages and convert data to mpe (based on a single API zone across the entire Erae surface)


-------


Hopefully Embodme implement high-resolution MPE directly into the Erae but till then, this method works  for me.

 

py
py
Login or Signup to post a comment