Skip to content
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

WavSteg: update to support higher sample widths (python3.12) #13

Closed
TheoSignore opened this issue Jan 19, 2024 · 3 comments
Closed

WavSteg: update to support higher sample widths (python3.12) #13

TheoSignore opened this issue Jan 19, 2024 · 3 comments

Comments

@TheoSignore
Copy link

TheoSignore commented Jan 19, 2024

Python3.12's wave module now supports higher sample widths.

Locally, I managed to modify WavSteg.py so it can handle a 24 bit sample width 44100Hz .wav file, with an lsb-count of 1.
Both hiding and recovering worked well.

My knowledge of python is limited and my tests were few, so I'd rather not submit the ugly fix I made as a pull request.

Here is a summary anyway:
WavSteg.py: Both in hide_data() and recover_data()
If a sample_width of 3 is detected, change it to 4

34  sample_width = sound.getsampwidth()
35         if sample_width == 3:
36             sample_width = 4;

The if protecting the maximum sample_width must be changed as well

@ragibson
Copy link
Owner

ragibson commented Jan 21, 2024

I'll need to look over the scope of the change in wave and can take a pass at this the next chance I get.

The override of sample width from 3 to 4 seems a bit strange, but perhaps the code called is just interpreting the samples as (zero-padded) 32-bit values and then truncating back when saving.

@ragibson
Copy link
Owner

This has been fixed in v1.6.0 by extending all the library's bit manipulations to allow non power of two byte depths.

@TheoSignore
Copy link
Author

Perfect ! Thank you for your work and your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants