SpectMorph
|
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... | |
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.
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). |
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.
mix_freq | sample rate to be used for reconstruction |
frame_size | frame size (in samples) |
frame_step | frame step (in samples) |
mode | selects decoding algorithm to be used |
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.
frame | the current frame (the frame to be decoded) |
next_frame | the frame after the current frame |
window | the reconstruction window used for MODE_PHASE_SYNC_OVERLAP |