Conversion of 24bit binary to int

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Wed Nov 19 12:03:46 CET 2003


On Wed, 12 Nov 2003 10:53:17 +0100, rumours say that Idar
<ip at itk.ntnu.no> might have written:

>But if you know how to convert this format (the file is about 6MB) 
>effeciently, pls do give me a hint. The data is stored binary with the 
>format:
>Ch1: 1536B (512*3B)
>..
>Ch6  1536B (512*3B)
>Then it is repeated again until end:
>Ch1  1536B (512*3B)
>..
>Ch6  1536B (512*3B)

So it's some audio file with 6 channels, right? (I missed the first
post)

I would take every chunk of 512*3 bytes, and for every 3 bytes,
struct.unpack('i', _3_bytes+'\0')[0] is the 32bit value (assuming
Intel's little endianness).

Hope this helps (no, really :)
-- 
TZOTZIOY, I speak England very best,
Ils sont fous ces Redmontains! --Harddix




More information about the Python-list mailing list