Filter

rtff::Filter

class Filter : public rtff::AbstractFilter

Simple frequential filter that applies the execute function on each frame.

Public Members

std::function<void(std::vector<std::complex<float> *>, uint32_t)> execute

the function to be executed on each time frequency block

See
rtff::AbstractFilter::ProcessTransformedBlock for more.

rtff::AbstractFilter

class AbstractFilter

Base class of frequential filters. Feed raw audio data and process them in the time frequency domain.

Subclassed by MyFilter, rtff::Filter

Public Functions

void Init(uint8_t channel_count, uint32_t fft_size, uint32_t overlap, std::error_code &err)

Initialize the filter.

Parameters
  • channel_count: the number of channel of the input signal
  • fft_size: the length in samples of the fourier transform window.
  • overlap: the number of samples that will be kept between each window.
  • err: an error code that gets set if something goes wrong

void Init(uint8_t channel_count, std::error_code &err)

Initialize the filter with default stft parameters.

Parameters
  • channel_count: the number of channel of the input signal
  • err: an error code that gets set if something goes wrong

void set_block_size(uint32_t value)

define the block size

Note
the block size correspond to the number of frames contained in each AudioBuffer sent to filter using the ProcessBlock function
Parameters
  • value: the block size

void ProcessBlock(AudioBuffer *buffer)

Process a buffer.

Note
the buffer should have the same channel_count and its frame_number should be equal to the filter block_size
Parameters
  • buffer: the data

uint32_t FrameLatency() const

Acccess the number of frame of latency generated by the filter.

Note
Due to fourier transform computation, a filter most usually creates latency. It depends on the block size, overlap and fft size.
Return
The latency generated by the filter in frames.

uint32_t fft_size() const

Return
the fft size in samples

uint32_t overlap() const

Return
the overlap in samples

uint32_t hop_size() const

Return
the hop size in sample

uint32_t window_size() const

Return
the window size in samples
Note
this value will be the same as the fft size

uint32_t block_size() const

Return
the block size
See
set_block_size

uint8_t channel_count() const

Return
the number of channel of the input signal

rtff::FilterImpl

class FilterImpl

the Filter Implementation. That class gather most of the filter implementation details. It is where the time amplitude signal is converted into a time frequency one

Public Functions

void Init(uint32_t fft_size, uint32_t overlap, uint8_t channel_count, std::error_code &err)

Initialize.

Parameters
  • fft_size: the length in samples of the fourier transform window.
  • overlap: the number of samples that will be kept between each
  • channel_count: the number of channel of the input signal
  • err: an error code that gets set if something goes wrong

void Analyze(TimeAmplitudeBuffer &amplitude, TimeFrequencyBuffer *frequential)

convert a signal to its time frequency representation

Note
this function modifies the original signal by multiplying it with the analysis window
Parameters
  • amplitude: the original signal buffer
  • frequential: the time frequency representation

void Synthesize(const TimeFrequencyBuffer &frequential, TimeAmplitudeBuffer *amplitude)

convert a time frequency representation into its signal

Parameters
  • frequential: the time frequency representation
  • amplitude: the signal buffer

const Eigen::VectorXf &analysis_window() const

Return
the window used for the analysis stage

const Eigen::VectorXf &synthesis_window() const

Return
the window used for the synthesis stage

uint32_t overlap() const

Return
the overlap in samples

uint32_t fft_size() const

Return
the fft size in samples

uint32_t window_size() const

Return
the window size in samples

uint32_t hop_size() const

Return
the hop size in sample