
The SysEx file format
=====================

Version 0.20 of !SysExy introduced a chunk-based file format for SysEx
files, replacing the previous RawSysEx format.

As of version 0.37, I have reverted to the older raw format, primarily
because this is the format used on other platforms, in the form of .syx
or .mdx files.  Inititially I thought of providing a user option to toggle
the save format, though could see no advantage to retaining the chunk
based format.

If you have a collection of SysEx files saved in the chunk-based format,
don't worry.  All versions of !SysExy can (and will continue to be able
to) load either format of file, though as of v0.37 it will only save using
the raw format.

The same filetype number is used for either format - &770.

The chunk-based format is now deprecated.

--------------------------------------------------------------------------

Raw format :

  F0 ..... F7
 (F0 ..... F7) (etc.)

  ie the raw Sys Ex data for one or more packets.  The file needs to be
  parsed (count the F0/F7 pairs) to determine the number of packets that
  it contains.

  This is the same as .syx or .mdx files found on Macs/PCs.

--------------------------------------------------------------------------

Chunk-based format :

  A Header chunk followed by one or more Packet chunks.
  Note that chunks need not be word aligned.

  Header chunk (12 bytes) :

    0 - 7     8 x chars : 'MIDISysX' ('M' being the first byte)
    8 - 11    uint32    : packet count ('p')

  Packet chunk (4 + packet length bytes) :

    0 - 3     uint32    : byte count for this packet ('b')
    4 - ..    b x chars : Packet data (F0 - F7)

  ie the first packet chunk will always be at offset '12'.

--------------------------------------------------------------------------

Thus to distinguish raw and chunk-based formats :

  Raw format         : first byte = 'F0' AND last byte = 'F7'
  Chunk-based format : first 8 chars = 'MIDISysX'

--------------------------------------------------------------------------

MimeMap :

  Although the &770 SysEx filetype is non-standard, you may nevertheless
  want to add the following entry to your MimeMap file :

    audio/sysex			SysEx	770	.syx	.mdx

  This will ensure that any downloaded .syx or .mdx files will
  automatically be typed to SysEx (&770).

--------------------------------------------------------------------------
