MIDI Bulk Dumps
by
on 11-28-2009 at 04:09 PM (1573 Views)
Sounds a bit rude, doesn't it!
I have tested and verified now that the MIDI bulk dump format for the Yamaha consoles, once converted from 7-bit to 8-bit is in fact the same format the setup files are. This opens up possibilities for sending and receiving large amounts of data without having to save and load files. Not sure of the practical applications just yet, but it's interesting, nonetheless.
The data is formatted as 8 bytes of 7-bit data which needs to be converted to 7 bytes of 8-bit data.
Byte(0) = 7 MSBs of the following 7 bytes, big-endian style. i.e. Bit 6 = MSB for Byte(1), Bit 5 = MSB for Byte(2), etc.
Byte(1)..Byte(7) = Bulk data without the MSB.
Yamaha gives us the conversion formula in the owners manual:
In reality, it's a bit trickier. The console sends out groups of bulk data bytes which need to be strung together to get the final converted set of bytes.Code:[Recovery from bulk data to actual data]d[0..6]: actual data b[0..7]: bulk data for(I=0; I<7; I++){b[0] <<= 1; d[I] = b[I+1]+(0x80 & b[0]);}
Each group has a header and a footer which need to be stripped off. The format of the header is detailed in the manual, and the footer is the usual F7 that's at the end of all sysex messages.
The number of bytes in each group is a 16-bit integer contained in the header at position 4 and 5. (little-endian)
So in vb.net, it looks like the following code. BulkDataLen is the size of each chunk. BulkData() is the incoming sysex of all the chunks, and RealData() is the converted data.
Seems to work.Code:BulkPos = 0 RealPos = 0 DoDim BulkDataLen As Integer = (Int(BulkData(BulkPos + 4)) << 7) + BulkData(BulkPos + 5) For Ofs As Integer = 12 To BulkDataLen + 5 Step 8Loop Until BulkPos > (BulkData.Count - 8)For i = 0 To 6Next Ofs BulkPos += BulkDataLen + 8 ' Skip the next headerBulkData(BulkPos + Ofs) <<= 1 RealData(RealPos + i) = BulkData(BulkPos + Ofs + i + 1) + (BulkData(BulkPos + Ofs) And &H80)Next RealPos += 7
![]()




Email Blog Entry