-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Add audioop.byteswap() #63840
Comments
The audio modules often need convert between little endian and big endian data. The array module can be used to byteswap 16- and 32-bit samples, but it can't help with 24-bit samples. Python implemented function for swapping bytes is not very efficient. In any case the use of array is not so simple (see bpo-19276, bpo-19633). The proposed patch adds efficient byteswap() function in the audioop module. byteswap(fragment, width) byteswaps every "width"-byte sample in the fragment and returns modified data. |
Updated patch addresses some Victor's comments. Added optimization for trivial case byteswap(bytes, 1). |
New changeset fbebc90abcd1 by Serhiy Storchaka in branch 'default': |
I have committed simplified patch, without optimization for 1-byte samples. |
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:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: