Open
Description
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.
import wave
with wave.open(open('out.wav', 'wb'), 'w') as w:
w.setframerate(44100)
w.setnchannels(1)
w.setsampwidth(1)
w.writeframes(b'0' * 44100)
w.setframerate(44100) # should not fail
w.setnchannels(1) # should not fail
w.setsampwidth(1) # should not fail
w.setframerate(22050) # should still fail
w.setnchannels(2) # should still fail
w.setsampwidth(2) # should still fail
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response