summaryrefslogtreecommitdiffstats
path: root/Lib/sunau.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/sunau.py')
-rw-r--r--Lib/sunau.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/sunau.py b/Lib/sunau.py
index 79750a9..9b3533d 100644
--- a/Lib/sunau.py
+++ b/Lib/sunau.py
@@ -104,6 +104,7 @@ is destroyed.
"""
from collections import namedtuple
+import warnings
_sunau_params = namedtuple('_sunau_params',
@@ -275,7 +276,9 @@ class Au_read:
data = self._file.read(nframes * self._framesize)
self._soundpos += len(data) // self._framesize
if self._encoding == AUDIO_FILE_ENCODING_MULAW_8:
- import audioop
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=DeprecationWarning)
+ import audioop
data = audioop.ulaw2lin(data, self._sampwidth)
return data
return None # XXX--not implemented yet
@@ -421,7 +424,9 @@ class Au_write:
data = memoryview(data).cast('B')
self._ensure_header_written()
if self._comptype == 'ULAW':
- import audioop
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', category=DeprecationWarning)
+ import audioop
data = audioop.lin2ulaw(data, self._sampwidth)
nframes = len(data) // self._framesize
self._file.write(data)