Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Loris::AiffFile Class Reference

Class AiffFile represents sample data in a AIFF-format samples file, and manages file I/O and sample conversion. More...

#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)
 Initialize an instance of AiffFile by importing sample data from the file having the specified filename or path.

template<typename Iter>  AiffFile (Iter begin_partials, Iter end_partials, double samplerate, double fadeTime=.001)
 Initialize an instance of AiffFile with samples rendered from a sequnence of Partials.

 AiffFile (double samplerate, size_type numFrames=0)
 Initialize an instance of AiffFile having the specified sample rate, preallocating numFrames samples, initialized to zero.

 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.

 AiffFile (const std::vector< double > &vec, double samplerate)
 Initialize an instance of AiffFile from a vector of sample data, with the specified sample rate.

 AiffFile (const AiffFile &other)
 Initialize this and AiffFile that is an exact copy, having all the same sample data, as another AiffFile.

AiffFileoperator= (const AiffFile &rhs)
 Assignment operator: change this AiffFile to be an exact copy of the specified AiffFile, rhs, that is, having the same sample data.

markers_typemarkers (void)
 Return a reference to the Marker (see Marker.h) container for this AiffFile.

const markers_typemarkers (void) const
 Return a const reference to the Marker (see Marker.h) container for this AiffFile.

double midiNoteNumber (void) const
 Return the fractional MIDI note number assigned to this AiffFile.

size_type numFrames (void) const
 Return the number of sample frames represented in this AiffFile.

double sampleRate (void) const
 Return the sampling freqency in Hz for the sample data in this AiffFile.

samples_typesamples (void)
 Return a reference (or const reference) to the vector containing the floating-point sample data for this AiffFile.

const samples_typesamples (void) const
 Return a const reference (or const reference) to the vector containing the floating-point sample data for this AiffFile.

void addPartial (const Loris::Partial &p, double fadeTime=.001)
 Render the specified Partial using the (optionally) specified Partial fade time, and accumulate the resulting samples into the sample vector for this AiffFile.

template<typename Iter> void addPartials (Iter begin_partials, Iter end_partials, double fadeTime=.001)
 Accumulate samples rendered from a sequence of Partials.

void setMidiNoteNumber (double nn)
 Set the fractional MIDI note number assigned to this AiffFile.

void 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.


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 manages only monaural (single channel) AIFF-format samples files.


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 = .001
 

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).

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 at which Partials are rendered
fadeTime is the Partial fade time for rendering the Partials on the specified range. If unspecified, the default fade time is 1 ms.
If compiled with NO_TEMPLATE_MEMBERS defined, this member accepts only PartialList::const_iterator arguments.

Loris::AiffFile::AiffFile double  samplerate,
size_type  numFrames = 0
[explicit]
 

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.

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 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 AiffFile other  ) 
 

Initialize this and AiffFile that is an exact copy, having all the same sample data, as another AiffFile.

Parameters:
other is the AiffFile to copy


Member Function Documentation

void Loris::AiffFile::addPartial const Loris::Partial p,
double  fadeTime = .001
 

Render the specified Partial using the (optionally) specified Partial fade time, and accumulate the resulting samples into the sample vector for this AiffFile.

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 default fade time is 1 ms.

template<typename Iter>
void Loris::AiffFile::addPartials Iter  begin_partials,
Iter  end_partials,
double  fadeTime = .001
 

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).

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 default fade time is 1 ms.
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.

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).

AiffFile& Loris::AiffFile::operator= const AiffFile rhs  ) 
 

Assignment operator: change this AiffFile to be an exact copy of the specified AiffFile, rhs, that is, having the same sample data.

Parameters:
rhs is the AiffFile to replicate

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


Generated on Thu Apr 14 22:01:55 2005 for Loris by doxygen 1.3.4