class SPCore::LanczosWindow

Produces a Lanczos window of a given size (number of samples). The Lanczos window is used in Lanczos resampling. For more info, see en.wikipedia.org/wiki/Window_function#Lanczos_window.

Attributes

data[R]

Public Class Methods

new(size) click to toggle source
# File lib/spcore/windows/lanczos_window.rb, line 7
def initialize size
  @data = Array.new size
  sinc = lambda {|x| (Math::sin(Math::PI * x))/(Math::PI * x) }
  size.times do |n|
    @data[n] = sinc.call(((2.0*n)/(size-1)) - 1)
  end
end