24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
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 ??? Thanks so much Robert Somerville --

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
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

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Irmen de Jong
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 ???

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
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

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Grant Edwards
On 2010-01-08, Irmen de Jong irmen-nosp...@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

Re: 24 bit signed integer binary conversion help needed

2010-01-08 Thread Irmen de Jong
On 8-1-2010 22:37, Grant Edwards wrote: On 2010-01-08, Irmen de Jongirmen-nosp...@xs4all.nl wrote: 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

24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
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 )

24 bit signed integer binary conversion help needed

2010-01-08 Thread Robert Somerville
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 ddd=struct.unpack(%ul % 1 ,dd) unpack(dd) the output of sext24 into a 32bit integer (seems to do the trick correctly for