this is not currently possible through WriteFile
. One option is to use libsndfile
directly: http://www.mega-nerd.com/libsndfile/
Another option, if you don't need to reuse the file immediately (e.g.: if you are storing it for logging data to disk): store it with WriteFile
as kBinary
and then use Matlab or Audacity or Sox to convert the raw data to an audio file.
Third option, if you want to re-open the file from within the program, you can still use WriteFile
with kBinary
, and read the raw data from disk into a buffer that you then playback.
Yet another option is to use puredata and [writesf~]
to write the file to disk.
All of these are sub-optimal and what is really needed is actually having WriteFile
use libsndfile
to write a valid audio file to disk. It's not a huge effort, I am happy to provide guidance if anyone is up for the task.