Giter VIP home page Giter VIP logo

Comments (11)

tttapa avatar tttapa commented on June 4, 2024

I've thought about this, but I haven't implemented it yet (and I can't test it at the moment).

I²C seems an easy solution:

  • Master receives MIDI over USB, parses it itself, and sends it over I²C to all slaves
  • Slaves receive MIDI over I²C and parse it.
  • Master sends MIDI over USB
  • Slaves store outgoing MIDI in the I²C buffer
  • Master requests outgoing MIDI from slaves and sends it over USB

There are a couple of caveats, however:

  • I don't know if the standard Wire library supports broadcast
  • Slaves can only send complete MIDI messages when the master requests it, if the slave is in the process of writing a long message into the buffer, and the I²C interrupt fires, it may send an incomplete MIDI message, then after that, MIDI messages from other slaves are sent over the same MIDI USB interface, causing malformed MIDI packets, or just mixing them up.
    The solution seems to be to make all slave I²C buffer writes atomic, by disabling interrupts when writing to the buffer.
  • How to prevent SysEx messages from being interrupted by data from other slaves? I don't know if I can make this atomic.
  • Is the 32-byte Wire buffer large enough?
  • If the master uses MIDI over USB, the I²C data to and from the slaves must be USB packets. If the master uses Serial MIDI, the I²C data must be Serial MIDI as well.
    If the protocols don't match, MIDI USB Cable Number data will get lost, and resources are wasted converting from one protocol to another.

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

from control-surface.

tttapa avatar tttapa commented on June 4, 2024

So could the midi transfer bus be on TX2 RX2? To avoid the interrupt issues? And would that then mean it could be in a midi serial protocol.

That's not possible, because only one slave can send data on the UART, you would need some kind of external bus access control, which is even more complicated, and should also use interrupts for reliability.
I²C is better suited because it handles the bus management for you.
You can perfectly send serial MIDI over I²C, that's not the issue here.

I'm sure this is a shit load of work to get it working but it would make your system absolutely powerful as hell and completely modular there could be 1 to 32 modules (16 faders 16 eq) on a single usb as there is dfinately enough midi assignments avaliable

I'm afraid I don't have the time right now. I have to focus on my studies, and adding this feature would take up too much time. It's not just writing code, you need architectural design, hardware testing, unit tests, refactoring, documentation, examples, etc.
It's too much work for the limited time I have available.

I'm thinking it might be easier to just use the ExtIO functions with "dumb" IO expanders instead of extra Arduinos.

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

from control-surface.

tttapa avatar tttapa commented on June 4, 2024

I'm in my third year of Electrical Engineering and Computer Science.

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

Hi Pete

when you get time would you be able to help me with some code using the I2c
i have no idea how to do it (i am going to have a look on the weekend)

i would like to have 2 buttons on the master module that when pressed send out a message to the slaves and the slaves will send a note on off to the pc (to change the vst track up or down in cubase as i can program this in the daw)
if this is possible

that way i can set up the fader modules i have with their own usb port and when they get the signal from the master they can all shift to their nex designated track at the same time in cubase
ie fader 1 would go to fader 17 (if i had 16 fader modules built)

Cheers Sam

from control-surface.

tttapa avatar tttapa commented on June 4, 2024

Is there a specific reason you're not using the ExtIO classes for buttons and LEDs? I think that would be much easier.

I²C is pretty straightforward, the master sends a message to a slave on a specific address, and the slave can reply to that message. The Arduino site has some working examples.
The next problem is coming up with some kind of protocol to tell the slave what to do. Then you'll also need a parser for that protocol.
My repository with motor fader code I linked to earlier contains an example of this (to set the parameters of the fader controller).

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

I am using the ext io functions for the push buttons and the LEDs on each module.

but with 16 faders each having 10 buttons (cubase specific) and a rotary encoder for each fader i would run out of pins quite quickly even with the ext io.
not to mention the eq module would have 16 rotary encoders and buttons
or the implementation of the motor faders .

Within cubase if i plug in one usb controller i can assign it to a generic remote
image
I currently have 2 fader modules plugged in on 2 generic controllers

Then in the editor for each generic controller i can create and delete custom vst banks which i can make anything i want it to be
i.e in a 16 fader module set up fader 1 module has 5 vst banks
VST 1 Channel 1
VST 2 Channel 17
VST 3 Channel 33
VST 4 Channel 49
VST 5 Input Channel 1
image

But to get all of the faders to change vst banks simultaneously i need to get them all to send out a midi message to the daw (button press from master module over the i2c) or connect all 16 pins assigned to a note button on each controller to a single switch and ground them at the same time (could cause issues).

This is why i was asking about the I2C comunication of midi data between modules so i can program cubase as one controller sending messages on different channels which makes the shifting of vst's easier

What are your thoughts?
also i understand the stress you would be under from university and that this is a side issue. so please dont feel obligated.

Thanks In advance Sam
My face time is [email protected] if you would like to see my setup and discuss the options in more depth.

from control-surface.

masydoblig avatar masydoblig commented on June 4, 2024

Hi Peter

It looks like you have implemented the communication between master and slave is this correct?

Does this mean i can have the master connected to the DAW and send midi data to the slaves like my examples above?
if so how do i do it? @tttapa

Cheers Sam

from control-surface.

tttapa avatar tttapa commented on June 4, 2024

Not directly, but you could use the MIDI Routing module to achieve something like this:

You'll have to implement the TrueMIDI_Sink interface to send MIDI to your slave, and TrueMIDI_Source to receive MIDI from your slave. How these implementations work is up to you, you can use pretty much any protocol you want.

from control-surface.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.