[Scipy-svn] r4640 - trunk/scipy/io

scipy-svn@scip... scipy-svn@scip...
Mon Aug 11 18:12:22 CDT 2008


Author: oliphant
Date: 2008-08-11 18:12:21 -0500 (Mon, 11 Aug 2008)
New Revision: 4640

Modified:
   trunk/scipy/io/wavfile.py
Log:
Fix 64-bit issue for wav-file reading.

Modified: trunk/scipy/io/wavfile.py
===================================================================
--- trunk/scipy/io/wavfile.py	2008-08-11 23:10:28 UTC (rev 4639)
+++ trunk/scipy/io/wavfile.py	2008-08-11 23:12:21 UTC (rev 4640)
@@ -4,7 +4,7 @@
 # assumes file pointer is immediately
 #  after the 'fmt ' id
 def _read_fmt_chunk(fid):
-    res = struct.unpack('lhHLLHH',fid.read(20))
+    res = struct.unpack('ihHIIHH',fid.read(20))
     size, comp, noc, rate, sbytes, ba, bits = res
     if (comp != 1 or size > 16):
         print "Warning:  unfamiliar format bytes..."
@@ -96,7 +96,7 @@
     bits = data.dtype.itemsize * 8
     sbytes = rate*(bits / 8)*noc
     ba = noc * (bits / 8)
-    fid.write(struct.pack('lhHLLHH', 16, 1, noc, rate, sbytes, ba, bits))
+    fid.write(struct.pack('ihHIIHH', 16, 1, noc, rate, sbytes, ba, bits))
     # data chunk
     fid.write('data')
     fid.write(struct.pack('i', data.nbytes))



More information about the Scipy-svn mailing list