This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Wave.py support for ulaw and alaw audio
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, ewoudenberg, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2006-05-07 23:23 by ewoudenberg, last changed 2022-04-11 14:56 by admin.

Files
File name Uploaded Description Edit
wave.py_unified_diff.zip ewoudenberg, 2006-05-07 23:23 unified diff from Lib/wave.py (At revision: 45934) to a wave.py with ulaw/alaw support
wave24.py ewoudenberg, 2009-05-08 19:14 Wave.py from python 2.4 with patch applied
wave25.py ewoudenberg, 2009-05-08 19:14 Wave.py from python 2.5 with patch applied
wave.py ewoudenberg, 2014-08-25 07:30 Wave.py from python 2.7 with patch applied
test_wave.py ewoudenberg, 2014-08-25 07:32 test_wave.py with added tests for ulaw and alaw format files.
Messages (5)
msg50204 - (view) Author: Eric Woudenberg (ewoudenberg) * Date: 2006-05-07 23:23
Dear Python Patch Center:

This is my first Python patch submission. Apologies for
any errors of protocol. I have been using these
submitted changes for several years and have even given
it out (I mentioned it a few years back on a python
mailing list.) I am confident to the best of my ability
that these changes are solid.

Unfortunately I don't have the capability of rebuilding
the documentation, but the changes to the documentation
are outlined below.

Please do not hesitate to contact me for further
information or assistance. I would be honored to have
these changes become part of some Python revision, be
it 2.5 or something further in the future.

Thank you,
Eric Woudenberg
eaw@connact.com

From my version of the wave.py file:

These changes allow .wav files containing u-law and
a-law data to be read and written. The user visible
changes are:

1) After a .wav file containing mu-law or a-law data is
opened for reading, a call to getcomptype() returns
'ULAW' (resp. 'ALAW') and a call to getcompname()
returns 'CCITT G.711 u-law' (resp. 'CCITT G.711 a-law').

2) After a wave object is created for writing,
setcomptype() can be called with the arguments ('ULAW',
'CCITT G.711 u-law') (resp. 'ALAW', 'CCITT G.711
a-law'). The second argument (text description) is ignored.

3) The comptype 'PCM' is now a synonym for 'NONE'.
PCM-containing wave files will return 'PCM' instead of
'NONE' for their comptype.
   
Note that this module does not do any u-law or a-law
format conversion to PCM, it simply allows users to
read or write u-law/a-law data from/to .wav files that
have conforming headers. For audio conversion of PCM
data to or from u-law, use the audioop module.
msg87462 - (view) Author: Eric Woudenberg (ewoudenberg) * Date: 2009-05-08 19:14
Patch applied to Python 2.4 wave.py
msg87463 - (view) Author: Eric Woudenberg (ewoudenberg) * Date: 2009-05-08 19:14
Patch applied to Python 2.5 wave.py
msg87499 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-05-09 14:37
Please read http://www.python.org/dev/patches/
The best format for a patch is a "diff -u" format. It's much much easier
to see what you changed to the existing code, and the same patch often
applies to several versions.
Also, 2.4 and 2.5 are closed for new developments - your changes would
only go to a 2.7 version.

And your change is more likely to be accepted if it contains unit tests
(in Lib/test/test_wave.py)
msg199865 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-14 11:05
For consistency with the aifc and sunau modules the wave module should compress/uncompress u-law and A-law data.
History
Date User Action Args
2022-04-11 14:56:17adminsetgithub: 43330
2014-08-25 07:32:51ewoudenbergsetfiles: + test_wave.py
2014-08-25 07:30:35ewoudenbergsetfiles: + wave.py
versions: + Python 2.7, - Python 3.4
2013-10-14 11:05:26serhiy.storchakasetversions: + Python 3.4, - Python 3.2
nosy: + serhiy.storchaka

messages: + msg199865

stage: test needed -> needs patch
2010-08-22 10:10:27BreamoreBoysetstage: test needed
versions: + Python 3.2, - Python 3.1, Python 2.7
2009-05-09 14:37:34amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg87499
2009-05-08 19:14:48ewoudenbergsetfiles: + wave25.py

messages: + msg87463
2009-05-08 19:14:09ewoudenbergsetfiles: + wave24.py

messages: + msg87462
2009-01-12 10:42:55gpolosettype: enhancement
versions: + Python 3.1, Python 2.7
2006-05-07 23:23:39ewoudenbergcreate