classification
Title: Add support for 24-bit samples in the audioop module
Type: behavior Stage: committed/rejected
Components: Extension Modules Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Peder.Jørgensen, eric.araujo, ezio.melotti, python-dev, r.david.murray, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2011-08-30 22:51 by Peder.Jørgensen, last changed 2013-10-20 06:43 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
audioop24.c Peder.Jørgensen, 2011-08-30 22:51 Not ready for release, he probably wants to clean it up first.
audioop_24bit.patch serhiy.storchaka, 2013-09-05 19:35 review
audioop_24bit_2.patch serhiy.storchaka, 2013-10-15 18:13 review
Messages (10)
msg143239 - (view) Author: Peder Jørgensen (Peder.Jørgensen) Date: 2011-08-30 22:51
Hi,
I'm working with audio in python 2.7 and I needed Audioop to work with
24bit files, it currently only supports 8 16 and 32 bit sound files.
(24bit files are very common in the audio world)
My brother knows c quite well, so he managed to patch it up to support 24bit files for me, he's a bit too shy to try and get it into the standard python package him self, so I thought i'd give it a go for him :) 

I think the updated audioop.c would be a great add-on to python, it's 100% backwards compatible, and should work fine with python 3.
I searched for hours and hours to see if someone had fixed it before, but found nothing.
Not sure if this is the right place for this kind of thing, but was the best place I could find on python.org

Also!
The file i uploaded is not ready for release, my brother will probably want to go over it a few times and do more testing.
msg143417 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-09-02 17:04
Welcome and thanks for your contribution!  If I understand correctly, support for 24-bit files would be a new feature for audioop, so our development policy excludes 2.7, a stable release which only gets bug fixes.  If you would like to turn your code into a patch (see guidelines in the devguide), it could be considered for inclusion in the next version.

If you think your improvements would be useful for 2.7 users, you could rename your module to audioop2 and publish it on PyPI (pay attention to proper attribution and licensing).

Feel free to ask any question! :)
msg195471 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013-08-17 14:15
What's the status of this?
msg197018 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-09-05 19:35
Unfortunately Peter's file is not ready for release. It adds support of 24-bit samples only to the part of functions, it works only on little-endian platform, it should crash on platforms which not allows non-aligned access, and I suspect it can overflow output buffers. And it doesn't provided in diff format.

Here is other patch which adds support for 24-bit samples. It also cleanup and simplify the code of audioop.c so that its total size is even decreased. Patch includes test and documentation changes.
msg199900 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-14 14:51
If there are no objections I will commit this.
msg199906 - (view) Author: Peder Jørgensen (Peder.Jørgensen) Date: 2013-10-14 15:13
This is great!
My brother did a few more updates to it and added support for endian conversion, and i've been using it a lot with out any problems, but i must admit your patch looks a lot cleaner Serhiy. Great work. Can't wait to test it. This is going to be of great use to everyone working with audio in python.
msg200008 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-15 18:13
Updated patch addresses Antoine's comments.
msg200462 - (view) Author: Roundup Robot (python-dev) Date: 2013-10-19 18:11
New changeset e1fa70053828 by Serhiy Storchaka in branch 'default':
Issue #12866: The audioop module now supports 24-bit samples.
http://hg.python.org/cpython/rev/e1fa70053828
msg200467 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-10-19 18:18
Thank you for your review Antoine.
msg200548 - (view) Author: Roundup Robot (python-dev) Date: 2013-10-20 06:43
New changeset 97ad9af5d5e7 by Serhiy Storchaka in branch 'default':
Issue #12866: Fix bias() for 24-bit. Add more tests.
http://hg.python.org/cpython/rev/97ad9af5d5e7
History
Date User Action Args
2013-10-20 06:43:28python-devsetmessages: + msg200548
2013-10-19 18:18:08serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg200467

stage: patch review -> committed/rejected
2013-10-19 18:11:30python-devsetnosy: + python-dev
messages: + msg200462
2013-10-15 18:13:21serhiy.storchakasetfiles: + audioop_24bit_2.patch

messages: + msg200008
2013-10-14 15:59:47serhiy.storchakaunlinkissue1575020 dependencies
2013-10-14 15:50:58serhiy.storchakaunlinkissue2259 dependencies
2013-10-14 15:13:10Peder.Jørgensensetmessages: + msg199906
2013-10-14 14:51:39serhiy.storchakasetmessages: + msg199900
2013-09-05 19:39:28serhiy.storchakalinkissue1575020 dependencies
2013-09-05 19:38:18serhiy.storchakalinkissue2259 dependencies
2013-09-05 19:36:00serhiy.storchakasetfiles: + audioop_24bit.patch

components: + Extension Modules
title: Want to submit our Audioop.c patch for 24bit audio -> Add support for 24-bit samples in the audioop module
keywords: + patch
nosy: + r.david.murray

messages: + msg197018
stage: patch review
2013-08-17 17:10:44serhiy.storchakasetassignee: serhiy.storchaka

nosy: + serhiy.storchaka
2013-08-17 14:15:21ezio.melottisetnosy: + ezio.melotti

messages: + msg195471
versions: + Python 3.4, - Python 3.3
2011-09-02 17:04:15eric.araujosetnosy: + eric.araujo

messages: + msg143417
versions: + Python 3.3, - Python 2.7
2011-08-30 22:51:52Peder.Jørgensencreate