Sending text over MIDI (to Arduino)


#1

Hello all, my project uses an Arduino (Adafruit Feather M0 Express) to power a control control surface and an Axoloti as a sound module.

The Arduino sends MIDI note data to the Axoloti over USB. I would also like for the Axoloti to send text back to the Arduino for display on a connected OLED screen. The text would consist of short patch names and numerical values.

Could this text be formatted as MIDI-out data, perhaps using SysEx? Has anyone attempted this? Might SPI be a better fit for the text data?

Thanks for any responses.


#2

if i were to do such a project i would consider the following:

-connect the OLED to the axoloti, since there is nice support from @SmashedTransistors for those 1.3 inch OLEDs.

or, if the OLED has to stay on the arduino

-send a midi cc or program change to the arduino and let it display the names directly (you will have to save the names in the arduino sketch, which makes it static.

implementing it via sysex can be done of course, but it will be a bit of a pain i think. (formatting the text in axoloti to sysex format, send it over, convert it back to a string to then display on the arduino)

so the questions are really, do the names have to be dynamic, do they change? or can you just put them into the arduino sketch and select them via an incoming midi cc or program change?


#3

I came across the thread regarding the OLED screens, which prompted me to consider whether I could get away with connecting the screen to the Axoloti instead. It might be possible, but I'll have to think about what changes to the overall software structure will be necessary. The text does have to be dynamic, unfortunately, as I want to be able to browse named audio samples stored on the Axo's SD card, with the capability to swap the samples out later.

I think my last resort would be to have the audio samples be numbered rather than named, so I could indeed just store the list of file numbers on the Arduino. I'd like to avoid that if possible though.


#4

I am currently working on a setup with a Axoloti and a Teensy, and i send data and commands over serial. I have created a small object that on demand reads the SD card of the Axoloti and sends the patch names to the Teensy. Is this something like what you are trying to achieve?


#5

That's exactly what I'm trying to achieve! Do you mind sharing your code?


#6

I will see if can get it on Github tonight after work.


#7

That would be fantastic, thank you. Just generally speaking, is it written in such a way that allows for commands to be sent from the Arduino to the Axoloti in real time (ie, press a key connected to Arduino, Axoloti plays a note)?


#8

I have looked to see if i could find the files, but i think they are in my archive, so it will take some time.


#9

@Krizroring I'm really interested aswell, mostly to see how you made your Serial Communication
I bought a NodeMCU in order to integrate OSC to Axoloti.

I use Liine Lemur a lot and being to customize interfaces would be a blessing.

The NodeMCU would:
* create an adhoc connection
* convert OSC messages to Serial and Serial to OSC
* and maybe convert 2 analog signal inputs into OSC to monitor the Signal on Lemur (using the oscilloscope)

I also need to make an Axoloti object that sends a list of every parameters to tweak when a patch is loaded or on request and their current value: an OSCQuery if you want

I going to start by using that simple code :
http://www.deadpixel.ca/arduino-osc/


#10

Over the Christmas holiday i will see what i can dig up form my archive


#11

@KrizRoring Cool, I will receive my NodeMCUs (along with a couple of OLED screens) after the holidays :slight_smile:
@alspacka I looked into Axoloti sources, just so you know; SYSEX is only implemented for the USB Host output port.

That's why I'm moving from SYSEX and considering OSC through Serial in order to get a bilateral communication system.


#12

@KrizRoring Looking forward to it.

Thanks @Suburb_Animal, I had actually just come across that info regarding sysex myself.

The commands I want to send from Ard to Axo lend themselves well to the unmodified midi standard, so that's what I plan to use for that piece. However, I learned that if I'm using the Ard's serial port for midi, it can't be used for anything else simultaneously unless you write your own muxing, which I don't want to do, and I'd also rather not have to try to modify midi code to be able to send ASCII from Axo to Ard.

So I think what I'm going to do is use midi for the Arduino to send commands to the Axoloti, and i2c for the Axoloti to send text to the Arduino. I'm guessing it will be mostly straightforward to send short strings over i2c.


#13

@alspacka
I2C could be a good idea since it's bilateral.
Now the question is what's Axoloti baud rate for those IO
I'm guessing it depends of the clock pin (SCL) (GPIO PB8)

I looked have but I didn't manage to know what FAST_DUTY_CYCLE stand exactly for:

static const I2CConfig i2cfg2 = {OPMODE_I2C, 400000, FAST_DUTY_CYCLE_2, };

    static uint8_t i2crxbuf[8];
    static uint8_t i2ctxbuf[8];
    static systime_t tmo;

#14

That's just the duty cycle mode for the clock. See this guide.

One item from this guide that I find concerning: "The current ChibiOS I2C driver allows only master mode offering a simple interface to use I2C in synchronous way only." -- But I'm already using the Arduino as a master device to communicate with my i2c control interface.


#15

@alspacka
Btw Arduino Mega has 4 Serial IOs (you can find copies for 10€ on aliexpress) and Arduino Uno has only 1 Serial but! you can use the SoftwareSerial Library to get an extra serial using digital IO (or even analog on the Mega)
You can find the information here
https://www.arduino.cc/en/Reference/SoftwareSerial
http://arduiniana.org/libraries/newsoftserial/
Newsoftserial is now named SoftwareSerial in Arduino IDE

or even using Altsoftserial (wich seems to work better if you add only one serial)
https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html
Just know that it works but costs quite a lot to the Arduino compared to an actual hardware serial