I'm trying to append data to a sound file without loading its contents(because it may have gigabytes of data), I'm using pysoundfile library currently, I've figured out a way to do it for wave64, but in wav, for some reason it's throwing an error.
According to the pysoundfile docs, when a SoundFile is opened with a file descriptor it should write without truncating, so thats what I'm doing currently
fd = open('foo.wav',mode='ab')
with sf.SoundFile(fd, mode = 'w', samplerate = self._samplerate,channels = self._channels, format = 'wav') as wfile:
wfile.seek(0,sf.SEEK_END)
wfile.write(self._samples)
wfile.close()
fd.close()
When I'm using wave filetype the following error occurs:
RuntimeError: Error opening <_io.BufferedWriter name='../datasets/emddf_clean/qcoisa.wav'>: Unspecified internal error.
But with a file formated in w64 it works somehow... If someone could shed a light on me that would be amazing, Thanks in advance!