Resampler

Warning

This feature is available only with a License - Contact us for more details

This objects implements a fractional resampler.
Rate convertion is performed when data is pushed, using ratio = input rate / output rate.
Internally, this uses a windowed sinc interpolator.

A Queue of 10 blocks is allocated.

Object Resampler {
    constructor Resampler();
    bool write( IQData, ratio );
    IQData read()
}

.write

Push IQ data block for resampling. The incoming sample rate is based on the attributes of the given IQData input, the conversion factor is :

ratio = input rate / output rate.

    write( IQDatain, ratio );
  • Incoming block is sliced in blocks of 65536 samples max
  • Each slice is then resampled using given ratio
  • Each resampled slice is then added to the intenal queue and can be retrieved using the read() method

Returns false is the internal queue is full.

Example :

var iq8k = ... /* assure we have a 8kHz IQ block */
var ratio = 8.0/48.0 ; /* we want to upconvert to 48kHz */

var rsp = new Resampler();
if( rsp.write( iq8k, ratio ) ) {
    var IQ48K = rsp.read();
    while( IQ48K.getLength() > 0 ) {

        do_something_with_data();

        // check if more data
        IQ48K = rsp.read();
    }
}

Warning :
Make sure your configuration does fit in the internal queue. Typically, if the input IQ data is long (length > 10*65536) then, the rate convert process will return false, stopping when the internal queue is full.

.read

Extracts a previously upconverted block from the internal queue.
If the queue was empty, the returned block length will be 0.

    var IQDataout = resampler.read();
Last update: January 8, 2022