#include <SpcFile.h>
Public Types | |
typedef std::vector< Marker > | markers_type |
typedef std::vector< Partial > | partials_type |
Public Member Functions | |
SpcFile (const std::string &filename) | |
template<typename Iter > | |
SpcFile (Iter begin_partials, Iter end_partials, double midiNoteNum=60) | |
SpcFile (double midiNoteNum=60) | |
markers_type & | markers (void) |
Return a reference to the MarkerContainer (see Marker.h) for this SpcFile. | |
const markers_type & | markers (void) const |
Return a reference to the MarkerContainer (see Marker.h) for this SpcFile. | |
double | midiNoteNumber (void) const |
const partials_type & | partials (void) const |
double | sampleRate (void) const |
void | addPartial (const Loris::Partial &p) |
void | addPartial (const Loris::Partial &p, int label) |
template<typename Iter > | |
void | addPartials (Iter begin_partials, Iter end_partials) |
void | setMidiNoteNumber (double nn) |
void | setSampleRate (double rate) |
void | write (const std::string &filename, double endApproachTime=0) |
void | writeSinusoidal (const std::string &filename, double endApproachTime=0) |
void | write (const std::string &filename, bool enhanced, double endApproachTime=0) |
Class SpcFile represents a collection of reassigned bandwidth-enhanced Partial data in a SPC-format envelope stream data file, used by the real-time bandwidth-enhanced additive synthesizer implemented on the Symbolic Sound Kyma Sound Design Workstation. Class SpcFile manages file I/O and conversion between Partials and envelope parameter streams.
typedef std::vector< Marker > Loris::SpcFile::markers_type |
the type of the container of Markers stored with an SpcFile
typedef std::vector< Partial > Loris::SpcFile::partials_type |
the type of the container of Partials stored with an SpcFile
Loris::SpcFile::SpcFile | ( | const std::string & | filename | ) | [explicit] |
Initialize an instance of SpcFile by importing envelope parameter streams from the file having the specified filename or path.
filename | the name of the file to import |
Loris::SpcFile::SpcFile | ( | Iter | begin_partials, | |
Iter | end_partials, | |||
double | midiNoteNum = 60 | |||
) | [inline] |
Initialize an instance of SpcFile 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.
begin_partials | the beginning of a range of Partials to prepare for Spc export | |
end_partials | the end of a range of Partials to prepare for Spc export | |
midiNoteNum | the fractional MIDI note number, if specified (default is 60) |
Loris::SpcFile::SpcFile | ( | double | midiNoteNum = 60 |
) | [explicit] |
Initialize an instance of SpcFile having the specified fractional MIDI note number, and no Partials (or envelope parameter streams).
midiNoteNum | the fractional MIDI note number, if specified (default is 60) |
void Loris::SpcFile::addPartial | ( | const Loris::Partial & | p, | |
int | label | |||
) |
Add a Partial, assigning it the specified label (and position in the Spc data).
A SpcFile can contain only one Partial having any given (non-zero) label, so an added Partial will replace a Partial having the same label, if such a Partial exists.
This may throw an InvalidArgument exception if an attempt is made to add unlabeled Partials, or Partials labeled higher than the allowable maximum.
void Loris::SpcFile::addPartial | ( | const Loris::Partial & | p | ) |
Add the specified Partial to the enevelope parameter streams represented by this SpcFile.
A SpcFile can contain only one Partial having any given (non-zero) label, so an added Partial will replace a Partial having the same label, if such a Partial exists.
This may throw an InvalidArgument exception if an attempt is made to add unlabeled Partials, or Partials labeled higher than the allowable maximum.
void Loris::SpcFile::addPartials | ( | Iter | begin_partials, | |
Iter | end_partials | |||
) | [inline] |
Add all Partials on the specified half-open (STL-style) range to the enevelope parameter streams represented by this SpcFile.
A SpcFile can contain only one Partial having any given (non-zero) label, so an added Partial will replace a Partial having the same label, if such a Partial exists.
If compiled with NO_TEMPLATE_MEMBERS defined, this member accepts only PartialList::const_iterator arguments.
This may throw an InvalidArgument exception if an attempt is made to add unlabeled Partials, or Partials labeled higher than the allowable maximum.
begin_partials | the beginning of a range of Partials to add to this Spc file | |
end_partials | the end of a range of Partials to add to this Spc file |
double Loris::SpcFile::midiNoteNumber | ( | void | ) | const |
Return the fractional MIDI note number assigned to this SpcFile. If the sound has no definable pitch, note number 60.0 is used.
const partials_type& Loris::SpcFile::partials | ( | void | ) | const |
Return a read-only (const) reference to the bandwidth-enhanced Partials represented by the envelope parameter streams in this SpcFile.
double Loris::SpcFile::sampleRate | ( | void | ) | const |
Return the sampling freqency in Hz for the spc data in this SpcFile. This is the rate at which Kyma must be running to ensure proper playback of bandwidth-enhanced Spc data.
void Loris::SpcFile::setMidiNoteNumber | ( | double | nn | ) |
Set the fractional MIDI note number assigned to this SpcFile. If the sound has no definable pitch, use note number 60.0 (the default).
void Loris::SpcFile::setSampleRate | ( | double | rate | ) |
Set the sampling freqency in Hz for the spc data in this SpcFile. This is the rate at which Kyma must be running to ensure proper playback of bandwidth-enhanced Spc data.
The default sample rate is 44100 Hz.
void Loris::SpcFile::write | ( | const std::string & | filename, | |
bool | enhanced, | |||
double | endApproachTime = 0 | |||
) |
Export the envelope parameter streams represented by this SpcFile to the file having the specified filename or path. Export phase-correct bandwidth-enhanced envelope parameter streams if enhanced is true (the default), or pure sinsoidal streams otherwise.
A nonzero endApproachTime indicates that the Partials do not include a release or decay, but rather end in a static spectrum corresponding to the final Breakpoint values of the partials. The endApproachTime specifies how long before the end of the sound the amplitude, frequency, and bandwidth values are to be modified to make a gradual transition to the static spectrum.
If the endApproachTime is not specified, it is assumed to be zero, corresponding to Partials that decay or release normally.
filename | the name of the file to create | |
enhanced | flag indicating whether to export enhanced (true) or sinusoidal (false) data | |
endApproachTime | the duration in seconds of the gradual transition to a static spectrum at the end of the sound (default 0) |
void Loris::SpcFile::write | ( | const std::string & | filename, | |
double | endApproachTime = 0 | |||
) |
Export the phase-correct bandwidth-enhanced envelope parameter streams represented by this SpcFile to the file having the specified filename or path.
A nonzero endApproachTime indicates that the Partials do not include a release or decay, but rather end in a static spectrum corresponding to the final Breakpoint values of the partials. The endApproachTime specifies how long before the end of the sound the amplitude, frequency, and bandwidth values are to be modified to make a gradual transition to the static spectrum.
If the endApproachTime is not specified, it is assumed to be zero, corresponding to Partials that decay or release normally.
filename | the name of the file to create | |
endApproachTime | the duration in seconds of the gradual transition to a static spectrum at the end of the sound (default 0) |
void Loris::SpcFile::writeSinusoidal | ( | const std::string & | filename, | |
double | endApproachTime = 0 | |||
) |
Export the pure sinsoidal (omitting phase and bandwidth data) envelope parameter streams represented by this SpcFile to the file having the specified filename or path.
A nonzero endApproachTime indicates that the Partials do not include a release or decay, but rather end in a static spectrum corresponding to the final Breakpoint values of the partials. The endApproachTime specifies how long before the end of the sound the amplitude, frequency, and bandwidth values are to be modified to make a gradual transition to the static spectrum.
If the endApproachTime is not specified, it is assumed to be zero, corresponding to Partials that decay or release normally.
filename | the name of the file to create | |
endApproachTime | the duration in seconds of the gradual transition to a static spectrum at the end of the sound (default 0) |