When I try reading each frame of a wav file, after a few frames it gives me this error at line 5: UnicodeDecodeError: 'utf-16-le' codec can't decode bytes in position 8-9: unexpected end of data
My code:
import wave
obj = wave.open('sound.wav','rb')
frames = obj.getnframes()
for i in range(1, frames):
test = ord(obj.readframes(i).decode('utf-16')[-1])
input(test)
input()
The wav file here is just static that I generated to use for this test. I couldn't find any solutions on stack overflow or on other forums, and I did try using utf-8 and utf-32 and they both didn't work.