En Tue, 22 Sep 2009 18:18:16 -0300, Jose Rafael Pacheco
<jose_rafael_pach...@yahoo.es> escribió:
Hello,
I want to read from a binary file called myaudio.dat
Then I've tried the next code:
import struct
name = "myaudio.dat"
f = open(name,'rb')
f.seek(0)
chain = "< 4s 4s I 4s I 20s I I i 4s I 67s s 4s I"
s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1)
a = struct.unpack(chain, s)
Easier:
fmt = struct.Struct(chain)
s = f.read(fmt.size)
a = fmt.unpack(s)
The audio data length is 300126, now I need a clue to build an array with
the audio data (The Chunk SDA_), would it possible with struct?, any
help ?
The chunk module (http://docs.python.org/library/chunk.html) is designed
to work with such file format.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list