Loris::AiffFile Class Reference
#include <AiffFile.h>
List of all members.
Public Types |
typedef std::vector< double > | samples_type |
| The type of the sample storage in an AiffFile.
|
typedef samples_type::size_type | size_type |
| The type of all size parameters for AiffFile.
|
typedef std::vector< Marker > | markers_type |
| The type of AIFF marker storage in an AiffFile.
|
Public Member Functions |
| AiffFile (const std::string &filename) |
template<typename Iter > |
| AiffFile (Iter begin_partials, Iter end_partials, double samplerate, double fadeTime=FadeTimeUnspecified) |
| AiffFile (double samplerate, size_type numFrames=0, unsigned int numChannels=1) |
| AiffFile (const double *buffer, size_type bufferlength, double samplerate) |
| AiffFile (const double *buffer_left, const double *buffer_right, size_type bufferlength, double samplerate) |
| AiffFile (const std::vector< double > &vec, double samplerate) |
| AiffFile (const std::vector< double > &vec_left, const std::vector< double > &vec_right, double samplerate) |
| AiffFile (const AiffFile &other) |
AiffFile & | operator= (const AiffFile &rhs) |
markers_type & | markers (void) |
const markers_type & | markers (void) const |
double | midiNoteNumber (void) const |
unsigned int | numChannels (void) const |
size_type | numFrames (void) const |
size_type | sampleFrames (void) const |
double | sampleRate (void) const |
samples_type & | samples (void) |
const samples_type & | samples (void) const |
void | addPartial (const Loris::Partial &p, double fadeTime=FadeTimeUnspecified) |
| fade time is taken from the Synthesizer DefaultParameters.
|
template<typename Iter > |
void | addPartials (Iter begin_partials, Iter end_partials, double fadeTime=FadeTimeUnspecified) |
void | setMidiNoteNumber (double nn) |
void | write (const std::string &filename, unsigned int bps=16) |
Detailed Description
Class AiffFile represents sample data in a AIFF-format samples file, and manages file I/O and sample conversion. Since the sound analysis and synthesis algorithms in Loris and the reassigned bandwidth-enhanced representation are monaural, AiffFile imports only monaural (single channel) AIFF-format samples files, though it can create and export a new two-channel file from a pair of sample vectors.
Constructor & Destructor Documentation
Loris::AiffFile::AiffFile |
( |
const std::string & |
filename |
) |
[explicit] |
Initialize an instance of AiffFile by importing sample data from the file having the specified filename or path.
- Parameters:
-
| filename | is the name or path of an AIFF samples file |
template<typename Iter >
Loris::AiffFile::AiffFile |
( |
Iter |
begin_partials, |
|
|
Iter |
end_partials, |
|
|
double |
samplerate, |
|
|
double |
fadeTime = FadeTimeUnspecified | |
|
) |
| | [inline] |
Initialize an instance of AiffFile with samples rendered from a sequnence of Partials. The Partials in the specified half-open (STL-style) range are rendered at the specified sample rate, using the (optionally) specified Partial fade time (see Synthesizer.h for an examplanation of fade time). Other synthesis parameters are taken from the Synthesizer DefaultParameters.
- See also:
- Synthesizer::DefaultParameters
- Parameters:
-
| begin_partials | is the beginning of a sequence of Partials |
| end_partials | is (one-past) the end of a sequence of Partials |
| samplerate | is the rate (Hz) at which Partials are rendered |
| fadeTime | is the Partial fade time (seconds) for rendering the Partials on the specified range. If unspecified, the fade time is taken from the Synthesizer DefaultParameters. |
If compiled with NO_TEMPLATE_MEMBERS defined, this member accepts only PartialList::const_iterator arguments.
Loris::AiffFile::AiffFile |
( |
double |
samplerate, |
|
|
size_type |
numFrames = 0 , |
|
|
unsigned int |
numChannels = 1 | |
|
) |
| | |
Initialize an instance of AiffFile having the specified sample rate, preallocating numFrames samples, initialized to zero.
- Parameters:
-
| samplerate | is the rate at which Partials are rendered |
| numFrames | is the initial number of (zero) samples. If unspecified, no samples are preallocated. |
| numChannels | is the number of channels of audio data to preallocate (default 1 channel) |
Loris::AiffFile::AiffFile |
( |
const double * |
buffer, |
|
|
size_type |
bufferlength, |
|
|
double |
samplerate | |
|
) |
| | |
Initialize an instance of AiffFile from a buffer of sample data, with the specified sample rate.
- Parameters:
-
| buffer | is a pointer to a buffer of floating point samples. |
| bufferlength | is the number of samples in the buffer. |
| samplerate | is the sample rate of the samples in the buffer. |
Loris::AiffFile::AiffFile |
( |
const double * |
buffer_left, |
|
|
const double * |
buffer_right, |
|
|
size_type |
bufferlength, |
|
|
double |
samplerate | |
|
) |
| | |
Initialize an instance of AiffFile from two buffers of sample data, with the specified sample rate. Both buffers must store the same number (bufferLength) of samples.
- Parameters:
-
| buffer_left | is a pointer to a buffer of floating point samples representing the left channel samples. |
| buffer_right | is a pointer to a buffer of floating point samples representing the right channel samples. |
| bufferlength | is the number of samples in the buffer. |
| samplerate | is the sample rate of the samples in the buffer. |
Loris::AiffFile::AiffFile |
( |
const std::vector< double > & |
vec, |
|
|
double |
samplerate | |
|
) |
| | |
Initialize an instance of AiffFile from a vector of sample data, with the specified sample rate.
- Parameters:
-
| vec | is a vector of floating point samples. |
| samplerate | is the sample rate of the samples in the vector. |
Loris::AiffFile::AiffFile |
( |
const std::vector< double > & |
vec_left, |
|
|
const std::vector< double > & |
vec_right, |
|
|
double |
samplerate | |
|
) |
| | |
Initialize an instance of AiffFile from two vectors of sample data, with the specified sample rate. If the two vectors have different lengths, the shorter one is padded with zeros.
- Parameters:
-
| vec_left | is a vector of floating point samples representing the left channel samples. |
| vec_right | is a vector of floating point samples representing the right channel samples. |
| samplerate | is the sample rate of the samples in the vectors. |
Loris::AiffFile::AiffFile |
( |
const AiffFile & |
other |
) |
|
Initialize this and AiffFile that is an exact copy, having all the same sample data, as another AiffFile.
- Parameters:
-
Member Function Documentation
void Loris::AiffFile::addPartial |
( |
const Loris::Partial & |
p, |
|
|
double |
fadeTime = FadeTimeUnspecified | |
|
) |
| | |
fade time is taken from the Synthesizer DefaultParameters.
Render the specified Partial using the (optionally) specified Partial fade time (see Synthesizer.h for an examplanation of fade time), and accumulate the resulting samples into the sample vector for this AiffFile. Other synthesis parameters are taken from the Synthesizer DefaultParameters.
- See also:
- Synthesizer::DefaultParameters
- Parameters:
-
| p | is the partial to render into this AiffFile |
| fadeTime | is the Partial fade time for rendering the Partials on the specified range. If unspecified, the |
template<typename Iter >
void Loris::AiffFile::addPartials |
( |
Iter |
begin_partials, |
|
|
Iter |
end_partials, |
|
|
double |
fadeTime = FadeTimeUnspecified | |
|
) |
| | [inline] |
Accumulate samples rendered from a sequence of Partials. The Partials in the specified half-open (STL-style) range are rendered at this AiffFile's sample rate, using the (optionally) specified Partial fade time (see Synthesizer.h for an examplanation of fade time). Other synthesis parameters are taken from the Synthesizer DefaultParameters.
- See also:
- Synthesizer::DefaultParameters
- Parameters:
-
| begin_partials | is the beginning of a sequence of Partials |
| end_partials | is (one-past) the end of a sequence of Partials |
| fadeTime | is the Partial fade time for rendering the Partials on the specified range. If unspecified, the fade time is taken from the Synthesizer DefaultParameters. |
If compiled with NO_TEMPLATE_MEMBERS defined, this member accepts only PartialList::const_iterator arguments.
double Loris::AiffFile::midiNoteNumber |
( |
void |
|
) |
const |
Return the fractional MIDI note number assigned to this AiffFile. If the sound has no definable pitch, note number 60.0 is used.
unsigned int Loris::AiffFile::numChannels |
( |
void |
|
) |
const |
Return the number of channels of audio samples represented by this AiffFile, 1 for mono, 2 for stereo.
size_type Loris::AiffFile::numFrames |
( |
void |
|
) |
const |
Return the number of sample frames represented in this AiffFile. A sample frame contains one sample per channel for a single sample interval (e.g. mono and stereo samples files having a sample rate of 44100 Hz both have 44100 sample frames per second of audio samples).
Assignment operator: change this AiffFile to be an exact copy of the specified AiffFile, rhs, that is, having the same sample data.
- Parameters:
-
size_type Loris::AiffFile::sampleFrames |
( |
void |
|
) |
const [inline] |
Bad old legacy name for numFrames.
- Deprecated:
- Use numFrames instead.
double Loris::AiffFile::sampleRate |
( |
void |
|
) |
const |
Return the sampling freqency in Hz for the sample data in this AiffFile.
Return a const reference (or const reference) to the vector containing the floating-point sample data for this AiffFile.
Return a reference (or const reference) to the vector containing the floating-point sample data for this AiffFile.
void Loris::AiffFile::setMidiNoteNumber |
( |
double |
nn |
) |
|
Set the fractional MIDI note number assigned to this AiffFile. If the sound has no definable pitch, use note number 60.0 (the default).
- Parameters:
-
| nn | is a fractional MIDI note number, 60 is middle C. |
void Loris::AiffFile::write |
( |
const std::string & |
filename, |
|
|
unsigned int |
bps = 16 | |
|
) |
| | |
Export the sample data represented by this AiffFile to the file having the specified filename or path. Export signed integer samples of the specified size, in bits (8, 16, 24, or 32).
- Parameters:
-
| filename | is the name or path of the AIFF samples file to be created or overwritten. |
| bps | is the number of bits per sample to store in the samples file (8, 16, 24, or 32).If unspeicified, 16 bits |
The documentation for this class was generated from the following file:
- /Users/kfitz/Projects/Loris/Loris development/src/AiffFile.h