Midi Merge Technique?

Fraser, Colin J Colin.Fraser at scottishpower.plc.uk
Fri Jan 21 10:58:42 CET 2000


> -----Original Message-----
> From: Byron G. Jacquot [mailto:thescum at surfree.com]
> Sent: 21 January 2000 01:10
> To: synth-diy at mailhost.bpa.nl
> Subject: Re: Midi Merge Technique?
> 
> 
> Just a quick clarification of terminology...I'm not as looped 
> as it might seem.
> 
> By "message," I meant a complete "packet" of MIDI data, not 
> just a single
> byte.  This could range from a 3-byte note on or off kinda 
> message, all the
> way up to a file/sample dump via sysex.  (If we're only 
> parsing bytes, we
> may as well just wire the 2 MIDI streams together with our 
> favourite logic
> gate! ;> )
-snip-
> It might be wise to increase priority for system real-time 
> messages from the
> input, as well.

Coincidentally, I've been writing midi merge code over the last few days to
provide soft thru on my analogue sequencer.

I use 3 FIFO buffers.
One for data received via midi, one for data generated by the sequencer, and
one for the transmit buffer.

A merge routine is called whenever data arrives in the rx or sequencer
buffers (unless the tx buffer is not empty), and also after a tx complete
interrupt. 
This routine checks if a complete message is ready to go from either source,
and then sends it (ie loads it into the tx buffer).
The status byte for every message received is written into the rx buffer
whether it is received or not.
The transmit routine keeps track of the last status byte sent, and misses
out unnecessary following status bytes.
I could elaborate on this if anyone's interested.

Anyway, there's a question I can't seem to find an answer to about the midi
spec.
Maybe someone here knows...

Is it legal for a system realtime message (F8, FA, FB, FC) to occur *during*
another message ?

For example, can midi clock occur inside a note on ? ie  90,3C,F8,7F...

The way I wrote the software on my sequencer and cv convertors, this is no
problem, but other devices may not like it.
Obviously, midi clock can only come from one source if two are being merged,
but if it can be inserted anywhere in the output stream, the merge process
should not introduce any significant timing errors for synced devices - if
system realtime is received, a flag can be set to tell the transmit routine
to resend the byte as soon as possible.


Colin f








More information about the Synth-diy mailing list