-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Wave_write throws an error if a setter to an written header information is set to the same value #132445
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
Comments
I think we can make it a no-op if we use the same value, but I'm not familiar with this module. Checking for whether something can be silently ignored or not requires to call the getters whenever we call the setters. I don't think it'll become slower by much but, ideally, I'd think it's more of an API misuse. That being said, it's also better if we don't make existing librairies unsable (piper-tts seems to have 30k downloads per month, not necessarily much but still noticable I'd say). Since the module is also quite niche on our side, I think we can do this kind of work on our side. @serhiy-storchaka any thoughts on this one? |
I do not think that this is a common case. Setters should be called after opening a file and before writing any data. If setter fails with some values and successes with other value, this can lead to bugs, when the code was tested with same values, but users use different values. |
We already have this case. Imagine a function that writes wave frames to a wave object, after setting its parameters.
That is not possible for all the getters in their current state, as they may also raise an Error. Also some values do not have a getter. That's why i opted to use those member variables directly. |
Feature or enhancement
Proposal:
The
Wave_write
class does not allow to "reset" the same value. This makes some implementations quite complicated, as if you want to continuously append data to the wav file, you need to differentiate between first and the other writes.Libraries, that use this class (for example piper-tts) are sometimes making it hard to do this right. Which is probably a bug in those libraries, but i think python should make it easier for them to not make this mistake.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: