Module: Radio::Filter::MixInterpolateFir

Includes:
SetupFir
Defined in:
lib/radio/filters/fir.rb

Instance Method Summary collapse

Methods included from SetupFir

#decimation_fir=, #decimation_mix=, #interpolation_fir=, #interpolation_mix=

Instance Method Details

#call(data) {|out.reshape!(out.size)| ... } ⇒ Object

Yields:

  • (out.reshape!(out.size))


278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/radio/filters/fir.rb', line 278

def call data
  @interpolation_phase /= @interpolation_phase.abs
  out = NArray.scomplex @interpolation_size, data.size
  index = 0
  data.each do |value|
    @interpolation_buf_c[@interpolation_fir_pos] = value
    @interpolation_fir_pos += 1
    @interpolation_fir_pos = 0 if @interpolation_fir_pos == @interpolation_fir_size
    iq = @interpolation_fir_coef[@interpolation_fir_pos].mul_accum @interpolation_buf_c, 0
    @interpolation_phase *= @interpolation_inc
    out[true,index] = iq.reshape!(iq.size).mul!(@interpolation_phase * @interpolation_size)
    index += 1
  end
  yield out.reshape!(out.size)
end