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

Hello! 


I recently got an Erae 2 and want to receive parsed finger data in Max. Thank you for your post—it’s practically the only viable solution. 


However, on my system, `eraesysex-midi.py` runs fine, and I can see real-time finger data in the terminal (on my Mac). But for some reason, `eraeapisysex.py` won’t run; the process terminates right at the start. I suspect this has something to do with the fact that `eraeapisysex.py` includes code from `erae_api_sysex.py`.


 I’ve made some adjustments, but it still isn’t working. Could you please give me some tips?

You should only need to run erae_sysex-midi.py. I should have named the files better as it's a bit confusing.


Attached is the python project as a single zip file. The Max patches are in the 'max' folder.


erae.sysex-midi.maxpat receives the sysex data and converts it into MIDI. Route it to your DAW by selecting the MIDI port in the [midiout] object.


Hope this helps

zip
Login or Signup to post a comment