[sdiy] MIDI merging info requested
Byron G. Jacquot
thescum at surfree.com
Tue May 10 08:31:36 CEST 2005
On 8 May 2005 at 18:02, David Brown wrote:
> It seems like with running status, sys events, and such, that you
> really need to decode both MIDI streams to be able to merge complete
> messages.
That's correct...MIDI relies heavily on keeping individual messages
intact.
> Is there a simple way to do this? Perhaps it is just decoding the
> commands and deciding how many bytes to pass before looking at the
> other MIDI stream. Seems like if the other stream doesn't have a
> complete command then you would hang. Perhaps this is never a
> problem.
If you can afford to filter out stuff you don't care about, that
simplifies it a bit...like dumping out sysex or realtime messages.
In general (and ignoring sysex and active sensing), it might look
something like:
1> Pass all the single byte realtime stuff (clock, start/stop, etc)
as it arrives. It can interrupt other messages if necessary.
2> Buffer messages until they're complete...since they're usually 2
or 3 bytes, this isn't hard. Be careful to track running status,
which will look like incomplete commands.
3> When a message buffer from either stream fills, send the complete
message. If you're clever, you can implement running status on that
output, independently of the 2 input streams. Hopefully, neither
stream is so dense that you can't interleave the other one in a
timely fashion.
Byron Jacquot
More information about the Synth-diy
mailing list