@@ -261,9 +261,9 @@ def readframes(self, nframes):
261261 #
262262
263263 def _read_fmt_chunk (self , chunk ):
264- wFormatTag , self ._nchannels , self ._framerate , dwAvgBytesPerSec , wBlockAlign = struct .unpack_from ('<hhllh ' , chunk .read (14 ))
264+ wFormatTag , self ._nchannels , self ._framerate , dwAvgBytesPerSec , wBlockAlign = struct .unpack_from ('<HHLLH ' , chunk .read (14 ))
265265 if wFormatTag == WAVE_FORMAT_PCM :
266- sampwidth = struct .unpack_from ('<h ' , chunk .read (2 ))[0 ]
266+ sampwidth = struct .unpack_from ('<H ' , chunk .read (2 ))[0 ]
267267 self ._sampwidth = (sampwidth + 7 ) // 8
268268 else :
269269 raise Error ('unknown format: %r' % (wFormatTag ,))
@@ -466,14 +466,14 @@ def _write_header(self, initlength):
466466 self ._nframes = initlength // (self ._nchannels * self ._sampwidth )
467467 self ._datalength = self ._nframes * self ._nchannels * self ._sampwidth
468468 self ._form_length_pos = self ._file .tell ()
469- self ._file .write (struct .pack ('<l4s4slhhllhh4s ' ,
469+ self ._file .write (struct .pack ('<L4s4sLHHLLHH4s ' ,
470470 36 + self ._datalength , b'WAVE' , b'fmt ' , 16 ,
471471 WAVE_FORMAT_PCM , self ._nchannels , self ._framerate ,
472472 self ._nchannels * self ._framerate * self ._sampwidth ,
473473 self ._nchannels * self ._sampwidth ,
474474 self ._sampwidth * 8 , b'data' ))
475475 self ._data_length_pos = self ._file .tell ()
476- self ._file .write (struct .pack ('<l ' , self ._datalength ))
476+ self ._file .write (struct .pack ('<L ' , self ._datalength ))
477477 self ._headerwritten = True
478478
479479 def _patchheader (self ):
@@ -482,9 +482,9 @@ def _patchheader(self):
482482 return
483483 curpos = self ._file .tell ()
484484 self ._file .seek (self ._form_length_pos , 0 )
485- self ._file .write (struct .pack ('<l ' , 36 + self ._datawritten ))
485+ self ._file .write (struct .pack ('<L ' , 36 + self ._datawritten ))
486486 self ._file .seek (self ._data_length_pos , 0 )
487- self ._file .write (struct .pack ('<l ' , self ._datawritten ))
487+ self ._file .write (struct .pack ('<L ' , self ._datawritten ))
488488 self ._file .seek (curpos , 0 )
489489 self ._datalength = self ._datawritten
490490
0 commit comments