SpectMorph
Public Types | Public Member Functions | List of all members
SpectMorph::SineDecoder Class Reference

Decoder for the sine component (deterministic component) of the signal. More...

#include <smsinedecoder.hh>

Public Types

enum  Mode { MODE_PHASE_SYNC_OVERLAP, MODE_PHASE_SYNC_OVERLAP_IFFT, MODE_TRACKING }
 Different supported modes for decoding. More...
 

Public Member Functions

 SineDecoder (double fundamental_freq, double mix_freq, size_t frame_size, size_t frame_step, Mode mode)
 Constructor setting up the various decoding parameters. More...
 
void process (const AudioBlock &block, const AudioBlock &next_block, const std::vector< double > &window, std::vector< float > &decoded_sines)
 Function which decodes a part of the signal. More...
 

Detailed Description

Decoder for the sine component (deterministic component) of the signal.

To decode a signal, create a SineDecoder and always call process with two frames, the current frame and the next frame.

Member Enumeration Documentation

Different supported modes for decoding.

Enumerator
MODE_PHASE_SYNC_OVERLAP 

This mode preserves the phases of the original signal, but signal modifications like looping a frame are not possible (without recomputing the phases in the frames at least).

MODE_PHASE_SYNC_OVERLAP_IFFT 

Like MODE_PHASE_SYNC_OVERLAP, however IFFTSynth is used to render the partials, which makes this mode faster than MODE_PHASE_SYNC_OVERLAP.

MODE_TRACKING 

This mode uses sine waves with phases derived from their frequency for reconstruction. in general this does not preserve the original phase information, but should still sound the same - also the frames can be reordered (for instance loops are possible).

Constructor & Destructor Documentation

SineDecoder::SineDecoder ( double  fundamental_freq,
double  mix_freq,
size_t  frame_size,
size_t  frame_step,
Mode  mode 
)

Constructor setting up the various decoding parameters.

Parameters
mix_freqsample rate to be used for reconstruction
frame_sizeframe size (in samples)
frame_stepframe step (in samples)
modeselects decoding algorithm to be used

Member Function Documentation

void SineDecoder::process ( const AudioBlock block,
const AudioBlock next_block,
const std::vector< double > &  window,
std::vector< float > &  decoded_sines 
)

Function which decodes a part of the signal.

This needs two adjecant frames as arguments.

Parameters
framethe current frame (the frame to be decoded)
next_framethe frame after the current frame
windowthe reconstruction window used for MODE_PHASE_SYNC_OVERLAP

The documentation for this class was generated from the following files: