[Tremor] Byte order problem

Michael Smith msmith at xiph.org
Thu Sep 23 00:10:06 PDT 2004


On Thursday 23 September 2004 16:55, Niklas Barsk wrote:
> > > > > Does anyone know why this happens and how I can solve it?
> >
> > You decode wass correct.  It's what you're doing with the data
> > afterward that's likely erroneous.
>
> That explains a lot. Since I cannot play sound files on the Unix I am
> working on I sent the decoded wav file to a PC and tried to play it
> there.
>
> Does this mean that all wav files created on a big endian machine is
> unplayable on a little endian machine and vice versa?

Wav files created anywhere should be playable anywhere. Wav files are always 
little-endian.

However, the application you're decoding with (I missed the start of this 
discussion, so I'm not sure whether that was the example decoder or your own 
application, but that doesn't matter) isn't creating a proper wav file - 
because it's not ensuring that the wav file is little endian.

Tremor decodes to host-endian because usually what you want is to directly 
output the decoded audio to an output device - which will usually accept data 
with the host's endianness. 

So, if you want to decode to a wav file, and host-endian is big-endian, you'll 
have to byte-swap the output. I'm guessing (without having checked) that the 
example decoder doesn't do this, since... well, it's just an example!

Mike



More information about the Tremor mailing list