CLAM::Frame Class Reference

Processing Data class to encapsulate a frame and all its related information. More...

#include <Frame.hxx>

List of all members.

Public Member Functions

 Frame ()
 Frame (const Frame &prototype, const bool shareData=false, const bool deep=true)
 __COMMON_DYNAMIC_TYPE (Frame, 14)
 __COMMON_DYN_ATTRIBUTE (0, public, TData, CenterTime) protected
 Value of time in the center of the frame in miliseconds.
bool LoadCenterTime (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (1, public, TData, Duration) protected
 Duration of the Frame in miliseconds.
bool LoadDuration (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (2, public, Spectrum, Spectrum) protected
 Spectrum analyzed from the Audio input (in SMS with Residual Window).
bool LoadSpectrum (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (3, public, Spectrum, SinusoidalAnalSpectrum) protected
 Spectrum analyzed from the Audio input (in SMS with Sinusoidal Window).
bool LoadSinusoidalAnalSpectrum (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (4, public, SpectralPeakArray, SpectralPeakArray) protected
 Vector of peaks in spectral analysis.
bool LoadSpectralPeakArray (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (5, public, Fundamental, Fundamental) protected
 Fundamental frequency of the information being analyzed.
bool LoadFundamental (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (6, public, Spectrum, OutSpec) protected
 Output global spectrum.
bool LoadOutSpec (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (7, public, Spectrum, ResidualSpec) protected
 Residual spectrum of the Audio.
bool LoadResidualSpec (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (8, public, Spectrum, SinusoidalSpec) protected
 Sinusoidal spectrum of the Audio.
bool LoadSinusoidalSpec (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (9, public, Audio, AudioFrame) protected
 Audio chunk we want to analyze.
bool LoadAudioFrame (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (10, public, Audio, SinusoidalAudioFrame) protected
 Sinusoidal synthesized Audio.
bool LoadSinusoidalAudioFrame (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (11, public, Audio, ResidualAudioFrame) protected
 Residual synthesized Audio.
bool LoadResidualAudioFrame (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (12, public, Audio, SynthAudioFrame) protected
 Global synthesized Audio.
bool LoadSynthAudioFrame (CLAM::Storage &s)
 __COMMON_DYN_ATTRIBUTE (13, public, bool, IsHarmonic) protected
 Is a harmonic frame or not.
bool LoadIsHarmonic (CLAM::Storage &s)
TData GetMag (TData freq) const
 Returns the Magnitude of a given frequency.
TData GetMag (TIndex pos) const
 Returns the Magnitude given a position in the Spectrum array.
TData GetPhase (TData freq) const
 Returns the Phase of a given frequency.
TData GetPhase (TIndex pos) const
 Returns the Phase of the spectrum related to a position in the Spectrum array.
void SetMag (TData freq, TData newMag)
 Replaces the Magnitude of the specified Frequency in the Spectrum with the value indicated.
void SetMag (TIndex pos, TData newMag)
 Replaces the Magnitude of the specified position in the Spectrum array with the value indicated.
void SetPhase (TData freq, TData newPhase)
 Replaces the Phase of the specified Frequency in the Spectrum with the value indicated.
void SetPhase (TIndex pos, TData newPhase)
 Replaces the Phase of the specified position in the Spectrum array with the value indicated.
SpectralPeak GetSpectralPeak (TIndex pos) const
 Returns the Spectral peak located in the given position.
SpectralPeak GetThruIndexSpectralPeak (TIndex pos) const
 Returns the Spectral peak located in the given position of the Spectral Array.
void SetSpectralPeak (TIndex pos, const SpectralPeak &spectralPeak, TIndex index=-1)
 This method allows to change values of a Spectral Peak given its position in the array.
void InsertSpectralPeak (TIndex pos, const SpectralPeak &spectralPeak, bool insertIndex=false, TIndex index=-1)
 Inserts a peak at the given position.
void AddSpectralPeak (const SpectralPeak &spectralPeak, bool addIndex=false, TIndex index=-1)
 Inserts a peak at the end of Spectral Array.
void DeleteSpectralPeak (TIndex pos, bool deleteIndex=false)
 Deletes a peak of Spectral Array.
TData GetResMag (TData freq) const
 Returns the Magnitude of a given frequency in residual Spectrum.
TData GetResMag (TIndex pos) const
 Returns the Magnitude given a position in the Residual Spectrum array.
TData GetResPhase (TData freq) const
 Returns the Phase of a given frequency in residual Spectrum.
TData GetResPhase (TIndex pos) const
 Returns the Phase of the spectrum related to a position in the residual Spectrum array.
void SetResMag (TData freq, TData newMag)
 Replaces the Magnitude of the specified Frequency in the residual Spectrum with the value indicated.
void SetResMag (TIndex pos, TData newMag)
 Replaces the Magnitude of the specified position in the residual Spectrum array with the value indicated.
void SetResPhase (TData freq, TData newPhase)
 Replaces the Phase of the specified Frequency in the residual Spectrum with the value indicated.
void SetResPhase (TIndex pos, TData newPhase)
 Replaces the Phase of the specified position in the residual Spectrum array with the value indicated.
TData GetFundamentalFreq (TIndex pos=0) const
 Returns the fundamental frequency at a given index.
TData GetFundamentalErr (TIndex pos=0)
 Returns the error of the candidate of a given index.
void SetFundamentalFreq (TIndex pos, TData newFreq) const
 Modifies the frequency of a candidate at a given index.
void SetFundamentalErr (TIndex pos, TData newErr) const
 Modifies the error of a candidate at a given index.
bool operator== (const Frame &newFrame) const
 If both frames have the same center time (value of time in the center of the frame this method will return true; false otherwise.
bool operator!= (const Frame &newFrame) const
 If center time of two frames is different will return true.
bool operator< (const Frame &newFrame) const
 If this frame is centered in a time inferior relative to the frame passed by parameter will return true; false otherwise.
bool operator<= (const Frame &newFrame) const
 If this frame is centered in a time inferior or equal in relation with the frame passed by parameter will return true; false otherwise.
bool operator> (const Frame &newFrame) const
 If this frame is centered in a time superior relative to the frame passed by parameter will return true; false otherwise.
bool operator>= (const Frame &newFrame) const
 If this frame is centered in a time superior or equal in relation with the frame passed by parameter will return true; false otherwise.

Protected Member Functions

void DefaultInit ()
 The concrete dynamic type constructor calls DefaultInit().

Detailed Description

Processing Data class to encapsulate a frame and all its related information.

A Frame has an associated time tag that points to the center of the audio chunk being used in the analysis and a duration. It also holds audio data in 4 attributes: AudioFrame is the input audio used for analysis; SynthAudioFrame is the synthesized audio after analysis and possible transformation; SinusoidalAudioFrame is the synthesized only sinusoidal component; ResidualAudioFrame is the synthesized only resiual component. A Frame also has three associated spectrums: Spectrum is the result of the STFT applied to the input audio; SinusoidalSpec is the spectrum of the sinusoidal component; ResidualSpec is the spectrum of the residual. Finally, a frame has SpectralPeakArray that holds the output of the Spectral Peak Detection algorithm and possibly a peak continuation.The Fundamental attribute holds the data of the output of the Fundamental detection algorithm. Note: There are some Getters and Setters, but for efficiency you need to work directly on the dynamic attributes

See also:
Spectrum, SpectralPeakArray, Fundamental, Audio

Definition at line 55 of file Frame.hxx.


Constructor & Destructor Documentation

CLAM::Frame::Frame (  )  [inline]

Definition at line 58 of file Frame.hxx.

CLAM::Frame::Frame ( const Frame prototype,
const bool  shareData = false,
const bool  deep = true 
) [inline]

Definition at line 58 of file Frame.hxx.


Member Function Documentation

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( 13  ,
public  ,
bool  ,
IsHarmonic   
) [inline]

Is a harmonic frame or not.

Definition at line 88 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( 12  ,
public  ,
Audio  ,
SynthAudioFrame   
) [inline]

Global synthesized Audio.

Definition at line 86 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( 11  ,
public  ,
Audio  ,
ResidualAudioFrame   
) [inline]

Residual synthesized Audio.

Definition at line 84 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( 10  ,
public  ,
Audio  ,
SinusoidalAudioFrame   
) [inline]

Sinusoidal synthesized Audio.

Definition at line 82 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Audio  ,
AudioFrame   
) [inline]

Audio chunk we want to analyze.

Definition at line 80 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Spectrum  ,
SinusoidalSpec   
) [inline]

Sinusoidal spectrum of the Audio.

Definition at line 76 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Spectrum  ,
ResidualSpec   
) [inline]

Residual spectrum of the Audio.

Definition at line 74 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Spectrum  ,
OutSpec   
) [inline]

Output global spectrum.

Definition at line 72 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Fundamental  ,
Fundamental   
) [inline]

Fundamental frequency of the information being analyzed.

Definition at line 70 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
SpectralPeakArray  ,
SpectralPeakArray   
) [inline]

Vector of peaks in spectral analysis.

Definition at line 68 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Spectrum  ,
SinusoidalAnalSpectrum   
) [inline]

Spectrum analyzed from the Audio input (in SMS with Sinusoidal Window).

Definition at line 66 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
Spectrum  ,
Spectrum   
) [inline]

Spectrum analyzed from the Audio input (in SMS with Residual Window).

Definition at line 64 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
TData  ,
Duration   
) [inline]

Duration of the Frame in miliseconds.

Definition at line 62 of file Frame.hxx.

CLAM::Frame::__COMMON_DYN_ATTRIBUTE ( ,
public  ,
TData  ,
CenterTime   
) [inline]

Value of time in the center of the frame in miliseconds.

Definition at line 60 of file Frame.hxx.

CLAM::Frame::__COMMON_DYNAMIC_TYPE ( Frame  ,
14   
)
void CLAM::Frame::AddSpectralPeak ( const SpectralPeak spectralPeak,
bool  addIndex = false,
TIndex  index = -1 
)

Inserts a peak at the end of Spectral Array.

Parameters:
spectralPeak New spectralPeak to insert
addIndex Value indicating if the index array should be modified, set by default to false
index Value of the given SpectralPeak, set by default to -1

Definition at line 97 of file Frame.cxx.

void CLAM::Frame::DefaultInit ( void   )  [protected]

The concrete dynamic type constructor calls DefaultInit().

This allows user to initialize his/her object. But we define DefaultInit() here because we don't want to force writting one DefaultInit() function for each concrete dynamic type. If a dynamic type concrete class defines some (not-default) constructors, this should also call the DefaultInit().

See also:
CopyInit()

Reimplemented from CLAM::DynamicType.

Definition at line 33 of file Frame.cxx.

References CLAM::DynamicType::UpdateData().

void CLAM::Frame::DeleteSpectralPeak ( TIndex  pos,
bool  deleteIndex = false 
)

Deletes a peak of Spectral Array.

Parameters:
pos Position of the Peak Array we want to delete
deleteIndex Value indicating if the index array should be modified, set by default to false

Definition at line 102 of file Frame.cxx.

TData CLAM::Frame::GetFundamentalErr ( TIndex  pos = 0  ) 

Returns the error of the candidate of a given index.

Parameters:
pos Position of candidate we want to get error value
Returns:
Value of Error in the position

Definition at line 147 of file Frame.cxx.

TData CLAM::Frame::GetFundamentalFreq ( TIndex  pos = 0  )  const

Returns the fundamental frequency at a given index.

Parameters:
pos Position of candidate we want to get frequency value
Returns:
Value of Frequency in the position given

Definition at line 143 of file Frame.cxx.

Referenced by CLAM::FrameInterpolator::Do().

TData CLAM::Frame::GetMag ( TIndex  pos  )  const

Returns the Magnitude given a position in the Spectrum array.

Parameters:
pos The position we want to know the Magnitude
Returns:
The Magnitude of spectrum in the index indicated

Definition at line 49 of file Frame.cxx.

TData CLAM::Frame::GetMag ( TData  freq  )  const

Returns the Magnitude of a given frequency.

Parameters:
freq The Frequency we want to know the Magnitude
Returns:
The Magnitude of spectrum in the frequency indicated

Definition at line 45 of file Frame.cxx.

TData CLAM::Frame::GetPhase ( TIndex  pos  )  const

Returns the Phase of the spectrum related to a position in the Spectrum array.

Parameters:
pos The position we want to know the Phase
Returns:
The Phase of spectrum in the position indicated

Definition at line 57 of file Frame.cxx.

TData CLAM::Frame::GetPhase ( TData  freq  )  const

Returns the Phase of a given frequency.

Parameters:
freq The Frequency we want to know the Phase
Returns:
The Phase of spectrum in the frequency indicated

Definition at line 53 of file Frame.cxx.

TData CLAM::Frame::GetResMag ( TIndex  pos  )  const

Returns the Magnitude given a position in the Residual Spectrum array.

Parameters:
pos The position we want to know the Magnitude
Returns:
The Magnitude of spectrum in the index indicated

Definition at line 112 of file Frame.cxx.

TData CLAM::Frame::GetResMag ( TData  freq  )  const

Returns the Magnitude of a given frequency in residual Spectrum.

Parameters:
freq The Frequency we want to know the Magnitude
Returns:
The Magnitude of spectrum in the frequency indicated

Definition at line 108 of file Frame.cxx.

TData CLAM::Frame::GetResPhase ( TIndex  pos  )  const

Returns the Phase of the spectrum related to a position in the residual Spectrum array.

Parameters:
pos The position we want to know the Phase
Returns:
The Phase of spectrum in the position indicated

Definition at line 120 of file Frame.cxx.

TData CLAM::Frame::GetResPhase ( TData  freq  )  const

Returns the Phase of a given frequency in residual Spectrum.

Parameters:
freq The Frequency we want to know the Phase
Returns:
The Phase of spectrum in the frequency indicated

Definition at line 116 of file Frame.cxx.

SpectralPeak CLAM::Frame::GetSpectralPeak ( TIndex  pos  )  const

Returns the Spectral peak located in the given position.

Parameters:
pos The position we want to obtain the Spectral peak
Returns:
The Spectral peak in the position indicated

Definition at line 80 of file Frame.cxx.

SpectralPeak CLAM::Frame::GetThruIndexSpectralPeak ( TIndex  pos  )  const

Returns the Spectral peak located in the given position of the Spectral Array.

Parameters:
pos The position of Peak Array we want to obtain the Spectral peak
Returns:
The Spectral peak in the position indicated

Definition at line 84 of file Frame.cxx.

void CLAM::Frame::InsertSpectralPeak ( TIndex  pos,
const SpectralPeak spectralPeak,
bool  insertIndex = false,
TIndex  index = -1 
)

Inserts a peak at the given position.

Parameters:
pos Position in the array where we want to insert the new peak
spectralPeak New spectralPeak to insert
insertIndex Value indicating if the index array should be modified, set by default to false
index Value of the given SpectralPeak, set by default to -1

Definition at line 92 of file Frame.cxx.

bool CLAM::Frame::LoadAudioFrame ( CLAM::Storage s  )  [inline]

Definition at line 80 of file Frame.hxx.

bool CLAM::Frame::LoadCenterTime ( CLAM::Storage s  )  [inline]

Definition at line 60 of file Frame.hxx.

bool CLAM::Frame::LoadDuration ( CLAM::Storage s  )  [inline]

Definition at line 62 of file Frame.hxx.

bool CLAM::Frame::LoadFundamental ( CLAM::Storage s  )  [inline]

Definition at line 70 of file Frame.hxx.

bool CLAM::Frame::LoadIsHarmonic ( CLAM::Storage s  )  [inline]

Definition at line 88 of file Frame.hxx.

bool CLAM::Frame::LoadOutSpec ( CLAM::Storage s  )  [inline]

Definition at line 72 of file Frame.hxx.

bool CLAM::Frame::LoadResidualAudioFrame ( CLAM::Storage s  )  [inline]

Definition at line 84 of file Frame.hxx.

bool CLAM::Frame::LoadResidualSpec ( CLAM::Storage s  )  [inline]

Definition at line 74 of file Frame.hxx.

bool CLAM::Frame::LoadSinusoidalAnalSpectrum ( CLAM::Storage s  )  [inline]

Definition at line 66 of file Frame.hxx.

bool CLAM::Frame::LoadSinusoidalAudioFrame ( CLAM::Storage s  )  [inline]

Definition at line 82 of file Frame.hxx.

bool CLAM::Frame::LoadSinusoidalSpec ( CLAM::Storage s  )  [inline]

Definition at line 76 of file Frame.hxx.

bool CLAM::Frame::LoadSpectralPeakArray ( CLAM::Storage s  )  [inline]

Definition at line 68 of file Frame.hxx.

bool CLAM::Frame::LoadSpectrum ( CLAM::Storage s  )  [inline]

Definition at line 64 of file Frame.hxx.

bool CLAM::Frame::LoadSynthAudioFrame ( CLAM::Storage s  )  [inline]

Definition at line 86 of file Frame.hxx.

bool CLAM::Frame::operator!= ( const Frame newFrame  )  const

If center time of two frames is different will return true.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 165 of file Frame.cxx.

bool CLAM::Frame::operator< ( const Frame newFrame  )  const

If this frame is centered in a time inferior relative to the frame passed by parameter will return true; false otherwise.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 169 of file Frame.cxx.

bool CLAM::Frame::operator<= ( const Frame newFrame  )  const

If this frame is centered in a time inferior or equal in relation with the frame passed by parameter will return true; false otherwise.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 173 of file Frame.cxx.

bool CLAM::Frame::operator== ( const Frame newFrame  )  const

If both frames have the same center time (value of time in the center of the frame this method will return true; false otherwise.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 161 of file Frame.cxx.

bool CLAM::Frame::operator> ( const Frame newFrame  )  const

If this frame is centered in a time superior relative to the frame passed by parameter will return true; false otherwise.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 177 of file Frame.cxx.

bool CLAM::Frame::operator>= ( const Frame newFrame  )  const

If this frame is centered in a time superior or equal in relation with the frame passed by parameter will return true; false otherwise.

Parameters:
newFrame Frame to be compared
Returns:
A boolean value, true is the condition is validated

Definition at line 181 of file Frame.cxx.

void CLAM::Frame::SetFundamentalErr ( TIndex  pos,
TData  newErr 
) const

Modifies the error of a candidate at a given index.

Parameters:
pos Position to change the error
newFreq New value of this position

Definition at line 155 of file Frame.cxx.

void CLAM::Frame::SetFundamentalFreq ( TIndex  pos,
TData  newFreq 
) const

Modifies the frequency of a candidate at a given index.

Parameters:
pos Position to change the frequency
newFreq New value of this position

Definition at line 151 of file Frame.cxx.

void CLAM::Frame::SetMag ( TIndex  pos,
TData  newMag 
)

Replaces the Magnitude of the specified position in the Spectrum array with the value indicated.

Parameters:
pos The position where we want to change Magnitude
newMag The new value of Magnitude

Definition at line 66 of file Frame.cxx.

void CLAM::Frame::SetMag ( TData  freq,
TData  newMag 
)

Replaces the Magnitude of the specified Frequency in the Spectrum with the value indicated.

Parameters:
freq The Frequency which we want to change Magnitude
newMag The new value of Magnitude

Definition at line 62 of file Frame.cxx.

void CLAM::Frame::SetPhase ( TIndex  pos,
TData  newPhase 
)

Replaces the Phase of the specified position in the Spectrum array with the value indicated.

Parameters:
pos The position where we want to change Phase
newPhase The new value of Phase

Definition at line 74 of file Frame.cxx.

void CLAM::Frame::SetPhase ( TData  freq,
TData  newPhase 
)

Replaces the Phase of the specified Frequency in the Spectrum with the value indicated.

Parameters:
freq The Frequency which we want to change Phase
newPhase The new value of Phase

Definition at line 70 of file Frame.cxx.

void CLAM::Frame::SetResMag ( TIndex  pos,
TData  newMag 
)

Replaces the Magnitude of the specified position in the residual Spectrum array with the value indicated.

Parameters:
pos The position where we want to change Magnitude
newMag The new value of Magnitude

Definition at line 129 of file Frame.cxx.

void CLAM::Frame::SetResMag ( TData  freq,
TData  newMag 
)

Replaces the Magnitude of the specified Frequency in the residual Spectrum with the value indicated.

Parameters:
freq The Frequency which we want to change Magnitude
newMag The new value of Magnitude

Definition at line 125 of file Frame.cxx.

void CLAM::Frame::SetResPhase ( TIndex  pos,
TData  newPhase 
)

Replaces the Phase of the specified position in the residual Spectrum array with the value indicated.

Parameters:
pos The position where we want to change Phase
newPhase The new value of Phase

Definition at line 137 of file Frame.cxx.

void CLAM::Frame::SetResPhase ( TData  freq,
TData  newPhase 
)

Replaces the Phase of the specified Frequency in the residual Spectrum with the value indicated.

Parameters:
freq The Frequency which we want to change Phase
newPhase The new value of Phase

Definition at line 133 of file Frame.cxx.

void CLAM::Frame::SetSpectralPeak ( TIndex  pos,
const SpectralPeak spectralPeak,
TIndex  index = -1 
)

This method allows to change values of a Spectral Peak given its position in the array.

Parameters:
pos Position of Peak Array to modify
spectralPeak New spectralPeak
inde Index value of the given SpectralPeak, set by default to -1

Definition at line 88 of file Frame.cxx.


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3