resamp_rrrf

Variants: resamp_cccf, resamp_crcf, resamp_rrrf

Arbitrary rate resampler, implemented as a polyphase filterbank

Public Functions

resamp_rrrf resamp_rrrf_create(float _rate, unsigned int _m, float _fc, float _as, unsigned int _npfb)
resamp_rrrf resamp_rrrf_create_default(float _rate)
resamp_rrrf resamp_rrrf_copy(resamp_rrrf _q)
int resamp_rrrf_destroy(resamp_rrrf _q)
int resamp_rrrf_print(resamp_rrrf _q)
int resamp_rrrf_reset(resamp_rrrf _q)
unsigned int resamp_rrrf_get_delay(resamp_rrrf _q)
int resamp_rrrf_set_scale(resamp_rrrf _q, float _scale)
int resamp_rrrf_get_scale(resamp_rrrf _q, float * _scale)
int resamp_rrrf_set_rate(resamp_rrrf _q, float _rate)
float resamp_rrrf_get_rate(resamp_rrrf _q)
int resamp_rrrf_adjust_rate(resamp_rrrf _q, float _gamma)
int resamp_rrrf_set_timing_phase(resamp_rrrf _q, float _tau)
int resamp_rrrf_adjust_timing_phase(resamp_rrrf _q, float _delta)
unsigned int resamp_rrrf_get_num_output(resamp_rrrf _q, unsigned int _num_input)
int resamp_rrrf_execute(resamp_rrrf _q, float _x, float * _y, unsigned int * _num_written)
int resamp_rrrf_execute_block(resamp_rrrf _q, float * _x, unsigned int _nx, float * _y, unsigned int * _ny)

Interfaces

resamp_rrrf resamp_rrrf_create(float _rate, unsigned int _m, float _fc, float _as, unsigned int _npfb)

Create arbitrary resampler object from filter prototype

  • _rate : arbitrary resampling rate, 0 < _rate
  • _m : filter semi-length (delay), 0 < _m
  • _fc : filter cutoff frequency, 0 < _fc < 0.5
  • _as : filter stop-band attenuation [dB], 0 < _as
  • _npfb : number of filters in the bank, 0 < _npfb

resamp_rrrf resamp_rrrf_create_default(float _rate)

Create arbitrary resampler object with a specified input resampling rate and default parameters. This is a simplified method to provide a basic resampler with a baseline set of parameters, abstracting away some of the complexities with the filterbank design. The default parameters are m = 7 (filter semi-length), fc = min(0.49,_rate/2) (filter cutoff frequency), as = 60 dB (filter stop-band attenuation), and npfb = 64 (number of filters in the bank).

  • _rate : arbitrary resampling rate, 0 < _rate

resamp_rrrf resamp_rrrf_copy(resamp_rrrf _q)

Copy object including all internal objects and state

int resamp_rrrf_destroy(resamp_rrrf _q)

Destroy arbitrary resampler object, freeing all internal memory

int resamp_rrrf_print(resamp_rrrf _q)

Print resamp object internals to stdout

int resamp_rrrf_reset(resamp_rrrf _q)

Reset resamp object internals

unsigned int resamp_rrrf_get_delay(resamp_rrrf _q)

Get resampler delay (filter semi-length \(m\))

int resamp_rrrf_set_scale(resamp_rrrf _q, float _scale)

Set output scaling for resampler

  • _q : resampler object
  • _scale : scaling factor to apply to each output sample

int resamp_rrrf_get_scale(resamp_rrrf _q, float * _scale)

Get output scaling for resampler

  • _q : resampler object
  • _scale : scaling factor to apply to each output sample

int resamp_rrrf_set_rate(resamp_rrrf _q, float _rate)

Set rate of arbitrary resampler

  • _q : resampling object
  • _rate : new sampling rate, 0 < _rate

float resamp_rrrf_get_rate(resamp_rrrf _q)

Get rate of arbitrary resampler

int resamp_rrrf_adjust_rate(resamp_rrrf _q, float _gamma)

adjust rate of arbitrary resampler

  • _q : resampling object
  • _gamma : rate adjustment factor: rate <- rate * gamma, 0 < _gamma

int resamp_rrrf_set_timing_phase(resamp_rrrf _q, float _tau)

Set resampling timing phase

  • _q : resampling object
  • _tau : sample timing phase, -1 <= _tau <= 1

int resamp_rrrf_adjust_timing_phase(resamp_rrrf _q, float _delta)

Adjust resampling timing phase

  • _q : resampling object
  • _delta : sample timing adjustment, -1 <= _delta <= 1

unsigned int resamp_rrrf_get_num_output(resamp_rrrf _q, unsigned int _num_input)

Get the number of output samples given current state and input buffer size.

  • _q : resampling object
  • _num_input : number of input samples

int resamp_rrrf_execute(resamp_rrrf _q, float _x, float * _y, unsigned int * _num_written)

Execute arbitrary resampler on a single input sample and store the resulting samples in the output array. The number of output samples depends upon the resampling rate but will be at most \( \lceil{ r \rceil} \) samples.

  • _q : resamp object
  • _x : single input sample
  • _y : output sample array (pointer)
  • _num_written : number of samples written to _y

int resamp_rrrf_execute_block(resamp_rrrf _q, float * _x, unsigned int _nx, float * _y, unsigned int * _ny)

Execute arbitrary resampler on a block of input samples and store the resulting samples in the output array. The number of output samples depends upon the resampling rate and the number of input samples but will be at most \( \lceil{ r n_x \rceil} \) samples.

  • _q : resamp object
  • _x : input buffer, shape: (_nx, 1)
  • _nx : input buffer
  • _y : output sample array (pointer)
  • _ny : number of samples written to _y