24 bit signed integer binary conversion help needed

Grant Edwards invalid at invalid.invalid
Fri Jan 8 22:37:26 CET 2010

On 2010-01-08, Irmen de Jong <irmen-NOSPAM- at xs4all.nl> wrote:
> On 8-1-2010 22:12, Robert Somerville wrote:
>> hi;
>> I am trying to read 24bit signed WAV format (little endian) data from a
>> WAV file and convert it to 32 bit little endian integer format ... can
>> anybody please tell me how to do the conversion from 24 bit to 32 bit
>> with a snippet of Python code ???
> Are you using the standard wave module? I guess that will
> produce a string of 3-byte audio frames with readframes().
> Won't it work to chop this up in individual 3-byte frames,
> then appending a '\0' char to every frame, and then writing
> the frames to the target wave ?

Not if the 3-byte values are signed two's compliment values.

Grant Edwards                   grante             Yow! I feel like I am
                                  at               sharing a ``CORN-DOG''
                               visi.com            with NIKITA KHRUSCHEV ...

More information about the Python-list mailing list