fbpx
Skip to main content

MIDI Forum

Midi Specification ...
 
Notifications
Clear all

Midi Specification for merging midi datas

6 Posts
3 Users
0 Reactions
3,824 Views
Thomas
Posts: 3
Active Member
Topic starter
 

I couldn’t find information about the organisation of midi datas to merge the datas for example for two inputs to one output. I want to build a midi merger with a Pic processor. The hardware is ready. For programming the PIC I need some information about that. Please let me know some informations.

 
Posted : 14/10/2022 12:08 am
Geoff
Posts: 1039
Noble Member
 

As I understand your question, you have two separate, and valid, midi streams, and you wish to merge these two streams into one. Where are the two streams from? What is createing them? Are they valid/complete midi streams?

A midi stream will usually contain at least some timing data. This cannot be merely merged. The midi data will contain midi messages, many of which will comprise multiple bytes of data, and these cannot be mixed up.

Logically, a process to merge the streams will need to separate the timing data out, separate each individual midi message, send on the midi messages, and create new timing data for the complete new stream. This is not a trivial task.

If you could provide an example of the sort of data you're talking about, both streams, I may be able to tell you more.

Geoff

 
Posted : 14/10/2022 7:12 am
Clemens Ladisch
Posts: 321
Reputable Member
 

MIDI streams do not contain timing data.

You have to parse all incoming messages in order to get running status at the output correct. And you have to decide what to do when a large SysEx on one port blocks messages from the other port.

 
Posted : 14/10/2022 9:48 am
Thomas
Posts: 3
Active Member
Topic starter
 

To all! I want to merge two Midi Inputs into one output. These are standard Midi Datas with one status byte and one or two date bytes.
In Input 1 datas are coming from a midi masterkeyboard (Hammond Clone). In Input 2 I send ProgrammChange CC. The Midi Output is connected to a bass synthesizer expander. So this is the task.

 
Posted : 15/10/2022 4:43 am
Clemens Ladisch
Posts: 321
Reputable Member
 

Merging without SysEx is easy.

A simple algorithm would work like this:
* There are three states, for when port 1/2 is in the middle of a command, or when none is.
* There a are three events that can trigger an action: a byte arrives on port 1/2, or the output port is ready to send the next byte.
* When a byte arrives, and the other port is not in the middle of a command, send it on. (But when the output port is not yet ready, you have to buffer it.)
* When a byte arrives, and the other port is in the middle of a command, store it in another buffer.
* When a command is finished, check if a buffer is not empty.

 
Posted : 16/10/2022 2:43 am
Thomas
Posts: 3
Active Member
Topic starter
 

Hi Clemens, many thanks. I will try it.

 
Posted : 17/10/2022 11:03 am
Share: