class SPCore::HannWindow

Produces a Hann window of a given size (number of samples). For more info, see en.wikipedia.org/wiki/Window_function#Hann_.28Hanning.29_window.

Attributes

data[R]

Public Class Methods

new(size) click to toggle source
# File lib/spcore/windows/hann_window.rb, line 6
def initialize size
  @data = Array.new(size)
  size.times do |n|
    @data[n] = 0.5 * (1 - Math::cos((TWO_PI * n)/(size - 1)))
  end
end