Skip to content

Allow specifying code packing order in audioop adpcm functions #76185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MosesofEgypt mannequin opened this issue Nov 10, 2017 · 6 comments
Closed

Allow specifying code packing order in audioop adpcm functions #76185

MosesofEgypt mannequin opened this issue Nov 10, 2017 · 6 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life type-bug An unexpected behavior, bug, or error

Comments

@MosesofEgypt
Copy link
Mannequin

MosesofEgypt mannequin commented Nov 10, 2017

BPO 32004
Nosy @ncoghlan, @serhiy-storchaka
Files
  • adpcm_test.zip: Zip containing an audio file and script to reproduce the issue
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2017-11-10.23:40:07.435>
    labels = ['3.8', 'type-bug', '3.7']
    title = 'Allow specifying code packing order in audioop adpcm functions'
    updated_at = <Date 2018-01-11.00:02:56.035>
    user = 'https://bugs.python.org/MosesofEgypt'

    bugs.python.org fields:

    activity = <Date 2018-01-11.00:02:56.035>
    actor = 'ncoghlan'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = []
    creation = <Date 2017-11-10.23:40:07.435>
    creator = 'MosesofEgypt'
    dependencies = []
    files = ['47258']
    hgrepos = []
    issue_num = 32004
    keywords = []
    message_count = 4.0
    messages = ['306063', '306488', '308225', '309786']
    nosy_count = 3.0
    nosy_names = ['ncoghlan', 'serhiy.storchaka', 'MosesofEgypt']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = None
    status = 'open'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue32004'
    versions = ['Python 3.7', 'Python 3.8']

    @MosesofEgypt
    Copy link
    Mannequin Author

    MosesofEgypt mannequin commented Nov 10, 2017

    --- 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

    @MosesofEgypt MosesofEgypt mannequin added type-feature A feature request or enhancement 3.7 (EOL) end of life 3.8 (EOL) end of life labels Nov 10, 2017
    @MosesofEgypt
    Copy link
    Mannequin Author

    MosesofEgypt mannequin commented Nov 18, 2017

    Changed type to behavior as this is more of a bug fix than an enhancement.

    @MosesofEgypt MosesofEgypt mannequin added type-bug An unexpected behavior, bug, or error and removed type-feature A feature request or enhancement labels Nov 18, 2017
    @MosesofEgypt
    Copy link
    Mannequin Author

    MosesofEgypt mannequin commented Dec 13, 2017

    Added serhiy.storchaka to nosy list as the issue has been open for over a month without response(not sure if I should have done this in the first place).

    @ncoghlan
    Copy link
    Contributor

    Adjusting target versions, as even though the status quo leads to mishandling some input data, the fix is a feature request to make the behaviour configurable, which restricts the change to 3.7+.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @hugovk
    Copy link
    Member

    hugovk commented Apr 11, 2022

    Closing, as the audioop module is deprecated in 3.11 and set for removal in 3.13.

    See PEP 594 – Removing dead batteries from the standard library, #91217 and #32392.

    @hugovk hugovk closed this as completed Apr 11, 2022
    @AlexWaygood
    Copy link
    Member

    Closing, as the audioop module is deprecated in 3.11 and set for removal in 3.13.

    See PEP 594 – Removing dead batteries from the standard library, #91217 and #32392.

    Cc. @MosesofEgypt

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants