thanks Grant, your sext24 function does the trick (this Python
newbie thanks you a lot ...) so i loop on d=wave.readframes(1) call dd=sext24(d) on the frame read , then unpack(dd) the output of sext24 into a 32bit integer (seems to do the trick correctly for signed 24 bit integers ....) > On 2010-01-08, Robert Somerville <rsomerville at sjgeophysics.com> wrote: > >> 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 ??? > > def sext24(d): > if ord(d[2]) & 0x80: > return d+'\xff' > else: > return d+'\x00' |
-- http://mail.python.org/mailman/listinfo/python-list