#include <SdifFile.h>
Public Types | |
typedef std::vector< Marker > | markers_type |
The type of marker storage in an SdifFile. | |
typedef PartialList | partials_type |
The type of the Partial storage in an AiffFile. | |
Public Member Functions | |
SdifFile (const std::string &filename) | |
template<typename Iter > | |
SdifFile (Iter begin_partials, Iter end_partials) | |
SdifFile (void) | |
Initialize an empty instance of SdifFile having no Partials. | |
markers_type & | markers (void) |
const markers_type & | markers (void) const |
partials_type & | partials (void) |
const partials_type & | partials (void) const |
void | addPartial (const Loris::Partial &p) |
Add a copy of the specified Partial to this SdifFile. | |
template<typename Iter > | |
void | addPartials (Iter begin_partials, Iter end_partials) |
void | write (const std::string &path) |
void | write1TRC (const std::string &path) |
Static Public Member Functions | |
static void | Export (const std::string &filename, const PartialList &plist, const bool enhanced=true) |
Class SdifFile represents reassigned bandwidth-enhanced Partial data in a SDIF-format data file. Construction of an SdifFile from a stream or filename automatically imports the Partial data.
Loris stores partials in SDIF RBEP and RBEL frames. The RBEP and RBEL frame and matrix definitions are included in the SDIF file's header. Each RBEP frame contains one RBEP matrix, and each row in a RBEP matrix describes one breakpoint in a Loris partial. The data in RBEP matrices are SDIF 32-bit floats.
The six columns in an RBEP matrix are: partialIndex, frequency, amplitude, phase, noise, timeOffset. The partialIndex uniquely identifies a partial. When Loris exports SDIF data, each partial is assigned a unique partialIndex. The frequency (Hz), amplitude (0..1), phase (radians), and noise (bandwidth) are encoded the same as Loris breakpoints. The timeOffset is an offset from the RBEP frame time, specifying the exact time of the breakpoint. Loris always specifies positive timeOffsets, and the breakpoint's exact time is always be earlier than the next RBEP frame's time.
Since reassigned bandwidth-enhanced partial breakpoints are non-uniformly spaced in time, the RBEP frame times are also non-uniformly spaced. Each RBEP frame will contain at most one breakpoint for any given partial. A partial may extend over a RBEP frame and have no breakpoint specified by the RBEP frame, as happens when one active partial has a lower temporal density of breakpoints than other active partials.
If partials have nonzero labels in Loris, then a RBEL frame describing the labeling of the partials will precede the first RBEP frame in the SDIF file. The RBEL frame contains a single, two-column RBEL matrix The first column is the partialIndex, and the second column specifies the label for the partial.
If markers are associated with the partials in Loris, then a RBEM frame describing the markers will precede the first RBEP frame in the SDIF file. The RBEM frame contains two single-column RBEM matrices. The first matrix contains 32-bit floats indicating the time (in seconds) for each marker. The second matrix contains UTF-8 data, the names of each of the markers separated by the ASCII character 0.
In addition to RBEP frames, Loris can also read and write SDIF 1TRC frames (refer to IRCAM's SDIF web site, www.ircam.fr/sdif/, for definitions of standard SDIF description types). Since 1TRC frames do not represent bandwidth-enhancement or the exact timing of Loris breakpoints, their use is not recommended. 1TRC capabilities are provided in Loris to allow interchange with programs that are unable to interpret RBEP frames.
Loris::SdifFile::SdifFile | ( | const std::string & | filename | ) | [explicit] |
Loris::SdifFile::SdifFile | ( | Iter | begin_partials, | |
Iter | end_partials | |||
) | [inline] |
Initialize an instance of SdifFile with copies of the Partials on the specified half-open (STL-style) range.
If compiled with NO_TEMPLATE_MEMBERS defined, this member accepts only PartialList::const_iterator arguments.
void Loris::SdifFile::addPartials | ( | Iter | begin_partials, | |
Iter | end_partials | |||
) | [inline] |
static void Loris::SdifFile::Export | ( | const std::string & | filename, | |
const PartialList & | plist, | |||
const bool | enhanced = true | |||
) | [static] |
Export the Partials in the specified PartialList to a SDIF file having the specified file name or path. If enhanced is true (the default), reassigned bandwidth-enhanced Partial data are exported in the six-column RBEP format. Otherwise, the Partial data is exported as resampled sinusoidal analysis data in the 1TRC format. Provided for backwards compatability.
const markers_type& Loris::SdifFile::markers | ( | void | ) | const |
markers_type& Loris::SdifFile::markers | ( | void | ) |
const partials_type& Loris::SdifFile::partials | ( | void | ) | const |
Return a reference to the bandwidth-enhanced Partials represented by this SdifFile.
partials_type& Loris::SdifFile::partials | ( | void | ) |
Return a reference to the bandwidth-enhanced Partials represented by this SdifFile.
void Loris::SdifFile::write | ( | const std::string & | path | ) |
Export the envelope Partials represented by this SdifFile to the file having the specified filename or path.
void Loris::SdifFile::write1TRC | ( | const std::string & | path | ) |
Export the envelope Partials represented by this SdifFile to the file having the specified filename or path in the 1TRC format, resampled, and without phase or bandwidth information.