[sdiy] Tips for writing a MIDI parser wanted

Seb Francis seb at burnit.co.uk
Wed Mar 25 13:40:48 CET 2009


Simon Brouwer wrote:
> Tom Wiltshire schreef:
>> One thing I've noticed with the transmit is that it is possible to 
>> send bytes from the PIC too quickly - there seems to be a minimum 
>> space required between them. Does anyone know how long this pause 
>> should be between the transmission of individual MIDI bytes? I can 
>> always find a value by trial and error, but that seems a bit uncertain.
> Then you probably don't check the UART transmit register empty flag 
> (in the PIC18Fxx20 for example, this is the TRMT bit in the TXSTA 
> register)?
> As long as you wait for the transmit register to become empty before 
> writing each byte, they will be transmitted correctly.
>

I would go along with this, but also add that you should be careful not 
to use all the MIDI bandwidth - consider if you are outputting MIDI 
messages in response to movement of pots, pitch bend wheels, etc.  Some 
older MIDI gear may not keep up with sustained fast data transmission, 
and even if this is not a problem, consider when this stream of data 
gets merged in your sequencer with some note on/off messages - then you 
have the strong possibility these time critical messages will get delayed.

For my JoyKontrol I make sure there is a gap of at least 1ms after every 
MIDI message, so effectively it can use at most 50% of the MIDI 
bandwidth.  This is probably still OTT in terms of information density 
but I wanted it to have a smooth response even to very fast moments of 
the controls (and anyway with most modern sequencers there is a function 
to reduce down continuous controller data if needed).

Seb






More information about the Synth-diy mailing list