write-sdif-file allows writing a list of time-tagged SDIFFRAME objects into a new file.

The SIDF types of every frame, and of every matrix in the frames must be either in the SDIF standard types, or declared with the
typesinput with a list ofSDIFTYPEobjects.
Name-value tables containing meta-data can also be included to the file with
SDIFNVTobjects connected to thenvtsinput.
Similar to open-file-stream, open-SDIF-stream opens and returns a “stream” to a file (designated using a pathname), which can be used to incrementally write SDIF data.

Before anything, it is necessary to write the SDIF file header with sdif-write-header. Optional inputs options allow declaring SDIF types, name-value tables, or stream descriptors:
types : a list ofSDIFTYPE objects.nvts : a list of SDIFNVT objects.sids : a list of stream descriptors of the form (ID name description) where ID is a number (the stream ID), name is a string, and descritpion is a “tree” (also a string, describing the purpose or “target” of the data un URL-style, e.g. "a/b/c").
Once the SDIF header is written, frames (SDIFFRAME objects) can be added in the files one by one with sdif-write-frame.

The “file stream” opened and returned by
open-SDIF-streamcan be closed withclose-SDIF-streamwhen no more read or write operations need to be done to the file.
→ See also how to do this in a loop in the See also the
sdif-write-loophelp-patch.
As a complement to dedicated file-reading tools, a number of dedicated functions help writing SDIF files from OM# objects:
bpf->sdif saves a BPF object as SDIF. The type of frames/matrices can be specified (and declared if necessary) using additional inputs if the function.
The
scopeparameter ofbpf->sdifdetermines whether the x-dimension of the BPF should be considered as time (default) or as the elements in a single matrix.
chord-seq->sdif saves a list of times as 1MRK/1TRC frames in a new SDIF file.
markers->sdif saves a list of times as empty 1MRK frames in a new SDIF file.
→ See also the
sdif-write-objectshelp-patch.