Skip to content

Commit

Permalink
use wave._Chunk instead of chunk.Chunk which will be deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
dmeliza committed Jan 14, 2024
1 parent b86d54e commit c060519
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ewave.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def nframes(self):
if hasattr(self, "_bytes_written"):
nbytes = self._bytes_written
else:
nbytes = self._data_chunk.getsize()
nbytes = self._data_chunk.chunksize
return nbytes // (self.dtype.itemsize * self.nchannels)

@property
Expand Down Expand Up @@ -233,7 +233,7 @@ def write(self, data, scale=True):
def _load_header(self):
"""Reads metadata from header"""
import struct
from chunk import Chunk
from wave import _Chunk as Chunk

from numpy import dtype

Expand Down Expand Up @@ -280,7 +280,7 @@ def _load_header(self):
) = struct.unpack(b"<HHLLHH", self._fmt_chunk.read(16))
# load extended block if it's there
if self._tag == WAVE_FORMAT_EXTENSIBLE:
if self._fmt_chunk.getsize() < 16:
if self._fmt_chunk.chunksize < 16:
raise Error("extensible format but no format extension")
cbSize, wValidBits, dwChannelMask, self._tag = struct.unpack(
b"<hhlH", self._fmt_chunk.read(10)
Expand Down

0 comments on commit c060519

Please sign in to comment.