- Edited
lokki o. 9 out of 10 times it works but if it doesn't the generated wav file has not much to do with my presets anymore.
can you describe what is in the generated "corrupted" wav file? Try and save several copies of the file without changing the preset of the content, so that you would expect it to generate exactly the same file over and over again. Set aside a "good" one, and a "corrupted" one.
First off, check if the size is exactly the same in both cases. Then use hexdump
to print a hex dump of the files and see where the differences are. You would expect that the header of the two .wav
files would be the same, and that there is some difference in the data part, perhaps.
lokki could it be that sometimes the data cannot be written right because it runs in the audio-thread?
This shouldn't be a problem, unless you suddenly kill the board without shutting down gracefully. If that is the case, when the file is corrupted you'd expect it to be shorter, or empty. You should probably add a call to sync()
(see man page ) after sf_close()
, to ensure the file is correctly synced to disk and not stored in a buffer by the OS.