MIDI Controller to MagicQ with Arduino

Questions concerning any LXSeries open source projects.
Comments and requests can also be posted on GitHub.
admin
Site Admin
Posts: 317
Joined: Mon Nov 20, 2017 4:31 pm

MIDI Controller to MagicQ with Arduino

Postby admin » Wed May 14, 2025 9:35 pm

I don't know if you remember, I bothered you some time ago for a problem with the artnet part in LX free schetc (ARTNET/SCAN to DMX) (problem on poll) that we then partially solved with the broacast address function.
I wanted to ask you a favor, if is possible...
I'm trying to reuse old dmx light consol (bheringer ) of mine equipped with MIDI and DMX out, as if ,it were a wing for Chamsys magicq.
Magicq, which I use, has the possibility of having the OSC protocol , or MIDI, or DMX / artnet scan, as input to drive some function (level , cue etc etc)

I modified a simple schech recovered in the osc library to convert from MIDI CC to OSC and everything works.
Unfortunately I discovered that the OSC implementation of chamsys does not cover some functions (Even if the manual states otherwise!!), which instead covers by DNX IN.

I tried to modify the source of LXArduinoDMXUSART (DMX IN to ARTNET/SCAN) , but I find it difficult to identify the "DMX data input" part.
In my little schect I intercept the midi CC coming from the console and transform them into OSC commands.this is part of my midi/osc routine

Code: Select all

void loop() {
  MIDI.read(); // leggi midi in
}

void handleOSC(float cc, const char* message)
{
 .... // tutta la coversiosione in OSC e spedizione
}

void MyCCFunction(byte midich, byte number, byte value) {
  switch (number) {
    case 21: // Controllo CC del canale 1 - a seguire gli altri
      cc = value / 127.0;
      message = "/ch/01/mix/01"; // comando OSC per dimmer CH1 Bheringer
      handleOSC(cc, message);
      break;

Before, to testo,I created a small program in VB6 to convert the MIDI messages into ARNET/SACN and everything works fine (MIDI OUT from Consol > MIDI IN PC > VB6 CONVERTER > LOOP MIDI > MAGICQ).
Afther I' ve test same function with DMX IN (intead of midi but direct via artenet/sacn) and all work fine too!

At this point I wanted to free the PC from this software "load" and move it to Arduino, to put "IN LINE" between the mixer and magicq(CONSOL MIDI OUT > ARDUINO TO DMX ARTNE/SACN > MAGICQ IN)
Could you tell me how to proceed, if possible...obviously?

admin
Site Admin
Posts: 317
Joined: Mon Nov 20, 2017 4:31 pm

Re: MIDI Controller to MagicQ with Arduino

Postby admin » Wed May 14, 2025 9:36 pm

I'm not completely clear on the hardware connections you are trying to implement. I think the basic idea is this:

Controller --(MIDI)--> Arduino --(Art-Net or sACN)--> MagicQ

The MIDI connection could be either old type 5-pin serial or USB.

The Art-Net or sACN connection generally would be ethernet and require a router.

5-pin serial and ethernet via a router is not difficult, you can find lots of examples.

USB for the MIDI requires that you have a board that can be a USB host. Because power for the board is often from the USB, you need separate power for the board. If the controller is powered by USB, then it is even more complicated.

The programming is probably simple if you know the IP address of the magicQ.

You'd use a MIDI library like this one: https://github.com/FortySevenEffects/ar ... di_library

here's a really basic example using LXDMXEthernet and the above MIDI library.

Code: Select all

#include <Ethernet.h>
#include <EthernetUdp.h>
#include <LXArtNet.h>
#include <LXDMXEthernet.h>
#include <LXSACN.h>
#include <MIDI.h>

#define MAC_ADDRESS 0x90, 0xA2, 0xDA, 0x10, 0x6C, 0xA8
// this is the IP address to which output packets are sent (MagicQ's IP address)
#define TARGET_IP 192,168,1,101

byte mac[] = {  MAC_ADDRESS };
IPAddress send_address = IPAddress(TARGET_IP);

// An EthernetUDP instance to let us send and receive packets over UDP
EthernetUDP eUDP;
// LXDMXEthernet instance ( created in setup so its possible to get IP if DHCP is used )
LXDMXEthernet* interface;


// Create and bind the MIDI interface to the default hardware Serial port
MIDI_CREATE_DEFAULT_INSTANCE();

void setup()
{
    MIDI.begin(MIDI_CHANNEL_OMNI);  // Listen to all incoming messages
    MIDI.setHandleControlChange(channelChange);

    Ethernet.begin(mac);
    interface = new LXSACN();
    eUDP.begin(interface->dmxPort());
    interface->setNumberOfSlots(512);
}

void loop()
{
    // Read incoming messages
    MIDI.read();
}

void channelChange(byte channel, byte number, byte value) {
    interface->setSlot(number, value*2);
    interface->sendDMX(&eUDP, send_address);
}

This example does not have a "keep alive" mechanism for sending periodic sACN packets when nothing has changed. It only sends packets when a control change happens. This probably works for your use, even if it is not strictly following typical ethernet DMX practice. To do that you'd need to figure out a timer in the loop() that calls interface->sendDMX(&eUDP, send_address); every three seconds.

I hope this helps get you pointed in the right direction. There's quite a bit about Arduino and MIDI if you use Google and search.