I am trying to write audio files (.aif) from an msp external i am working on.
A file is written successfully, however, it does not open
in QT for example (stating end-of-file not found).
I am wondering where I am going wrong. Do I not have to write .aiff header information before writing my data or is this
handled by the sys API since I specify my file type as being 'AIFF'.
Here is a snippet of my code:
// create file name to save .aif file as
char fileName = "doormouse";
short path = defvolume();
long type = 'AIFF';
long fileSizeBytes = sizeof(float) * wsf->tableSize;
// First: Create File
err = path_createsysfile(fileName, path, type, &fh);
fh = 0;
error("writesf~: error %d creating file", err);
// Second: Write File
err = sysfile_write(fh, &wsf->tableSize, wsf->table);
error("writesf~: error %d writing file", err);
// Third: Close File
sysfile_seteof(fh, fileSizeBytes); // state end-of-file
post("writesf~: wrote file %s sucessfully", fileName);