MADRIX Forum • HOW TO get midi into madrix from within python
Page 1 of 1

HOW TO get midi into madrix from within python

Posted: Mon Jun 24, 2024 11:27 am
by mrfast
Hello Madrix!

I have a client that wishes to show sensor input on his LED setup. He has a fitness studio and wants some values like heartbeat etc to be displayed.
I do have the sensor values in python already done.
Now he said he is using a MADRIX5 usb stick. (can provide picture of it if needed).
The stick is plugged in a windows machine where the python script is located too.

Now my question is how do i interact with it from within python?
I can generate midi with python no problem but how do i output it so the madrix can have it as an input?

All help is appreciated! :mrgreen:

PS:
he said he want to setup the lights specific actions himself. he just need "an input he can work with". I have no prior experience with the madrix software but i assume he is familiar with the madrix software and just needs an input source that the software understands.

Re: HOW TO get midi into madrix from within python

Posted: Tue Jun 25, 2024 9:07 am
by Guertler
Hello mrfast,
Welcome to the MADRIX forum.

The easiest way would be to send the MIDI command as MIDI note or control chance via a so called virtual MIDI cable from your phython scipt ton MADRIX.
MADRIX is able to receive MIDI commands from all connected MIDI sources.
With the help of MIDI-IN Remote Editor you are able to configure the action which should be triggered if the received MIDI command will change the value.

In the explained example with the heartbeat you can assign the command to the "Opacity" of an MADRIX effect layer and now this layer will be visible (or not) according to the recieved midi value.

Re: HOW TO get midi into madrix from within python

Posted: Fri Jun 28, 2024 7:36 pm
by mrfast
Thank you for your response!

I'm struggling to implement your suggestions in code. I attempted to use the mido library for MIDI transmission, but none of the ports seem to be functioning.

Could you please share sample code demonstrating how to send any type of input to MADRIX?

My goal is to transmit data to MADRIX from a Python script, and it doesn't necessarily have to be MIDI. If there's an alternative method available, could you provide example code or guide me in the right direction?

I came across information about using HTTP for this purpose on [https://help.madrix.com/m5/html/madrix/index.html?hidd_remote_http.html]. However, I'm uncertain how to implement this using Python. Any assistance or sample code would be greatly appreciated.

Re: HOW TO get midi into madrix from within python

Posted: Tue Jul 02, 2024 10:07 am
by Guertler
Hello mrfast,

We are not able to send you a sample Python script to send MIDI to MADRIX. But as soon as you can receive the MIDI signal in MADRIX we can help you further. To double check if a MIDI command will be received you are able to watch the traffic of the desired device in MADRIX. Simply activate "Watch" and open the "MIDI Watcher" at the "MIDI" tab of the "Device Mangager" in MADRIX.

To send HTTP commands won't be an option because in that case you can only trigger MADRIX but the information can't be used to interpret it in a MADRIX script.

Alternatively you can send DMX respectively Art-Net or sACN data.
Furthermore the MADRIX Script is also able to read from a file with a maximum access time of 10ms.

I hope this will help you.