[music-dsp] endianess and MIDI sample dump standard

robert bristow-johnson rbj at audioimagination.com
Mon Apr 14 14:09:24 EDT 2008


> ----- Original Message -----
> From: "robert bristow-johnson" <rbj at audioimagination.com>
> To: music-dsp at music.columbia.edu
> Subject: [music-dsp] endianess and MIDI sample dump standard
> Date: Mon, 14 Apr 2008 13:24:28 -0400
> 
> 
> 
> 
> 
> i know that nobody uses it anymore (or would want to use it), but can anyone 
> who has coded and used the MIDI SDS 
> http://www.4front-tech.com/pguide/midi/midi8.html confirm to me that, 
> although everywhere else in MIDI, the numerical format for any numbers longer 
> than 7 bits is Little-Endian, yet for the actual samples in the SDS packets, 
> it's Big-Endian.  is that the case?  here is a specific example in the 
> document:
> 
> "
>      Example:  Assume  a data point in the memory of a 16-bit
>      sampler, with the value 87E5. In binary, that would be
> 
>                            1000 0111 1110 0101
> 
>      and would be encoded as the following MIDI data stream:
> 
>                        01000011 01111001 00100000
> "
> 
> it seems to me that if the 01000011 byte goes out first, then it's Big-Endian 
> which is inconsistent with the rest of the MIDI standard.  why would they 
> adopt two opposite conventions?

now that i read the document more carefully, i see it says

"
    The packet number is followed by 120 bytes of data, which form
    60,  40,  or 30 words (MSB first for multiword samples),  depending on
    the length of a single data sample.
"

by "multiword samples", i think they should have said "multibyte samples".  now whether it is 60 two-byte words or 40 three-byte words or 30 four-byte words, that depends solely on the "ee" byte:

"
    ee       =     sample format (number of significant bits; 8->28)
"

right?  ee = 8 to 14 bits samples means it's 60 two-byte words, for ee = 15 to 21 bits, it's 40 three-byte words, for ee = 22 to 28 bits, it's 30 four-byte words, right?  i can see no other parameter to base that decision on, but, if someone can confirm, it would be nice.

thanks,

--

r b-j                  rbj at audioimagination.com

"Imagination is more important than knowledge."



More information about the music-dsp mailing list