On 2010-01-08, Grant Edwards <inva...@invalid.invalid> wrote: > On 2010-01-08, Robert Somerville <rsomervi...@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'
I guess I assumed you knew how to read 3 bytes of data from a file: f = open('datafile','rb') d = f.read(3) -- Grant Edwards grante Yow! I need to discuss at BUY-BACK PROVISIONS visi.com with at least six studio SLEAZEBALLS!! -- http://mail.python.org/mailman/listinfo/python-list