[New-bugs-announce] [issue32004] Allow specifying code packing order in audioop adpcm functions

MosesofEgypt report at bugs.python.org
Fri Nov 10 18:40:07 EST 2017


New submission from MosesofEgypt <mosesbobadilla at gmail.com>:

--- Issue ---
audioop.adpcm2lin and audioop.lin2adpcm currently treat the high 4 bits of each byte as the first code and the low 4 as the second code. In practice this is often the opposite.
http://www.drdobbs.com/database/algorithm-alley/184410326
https://wiki.multimedia.cx/index.php/Microsoft_IMA_ADPCM

--- Steps to reproduce ---
Run the attached script to decompress the attached wav to two different 16bit signed pcm wav files. The "GOOD" one had the nibbles of each code swapped before being decoded, while the "BAD" one didnt.

--- Suggested fix ---
I propose an additional optional boolean parameter to these functions to specify which nibble is the first code and which is the second.

NOTE: I haven't compiled my changes to test as I do not know how to set up a cpython build environment. This commit is more intended to show how to implement the fix.
https://github.com/MosesofEgypt/cpython/commit/4a5ca65833ec79857f065546ae0d90661ce26f5f

----------
files: adpcm_test.zip
messages: 306063
nosy: MosesofEgypt
priority: normal
severity: normal
status: open
title: Allow specifying code packing order in audioop adpcm functions
type: enhancement
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47258/adpcm_test.zip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32004>
_______________________________________


More information about the New-bugs-announce mailing list