Class: SPCore::BlackmanWindow

Inherits:
Object
  • Object
show all
Defined in:
lib/spcore/windows/blackman_window.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(size) ⇒ BlackmanWindow

Returns a new instance of BlackmanWindow.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/spcore/windows/blackman_window.rb', line 6

def initialize size
  @data = Array.new size
  alpha = 0.16
  a0 = (1 - alpha) / 2.0
  a1 = 0.5
  a2 = alpha / 2.0
  
  size.times do |n|
    @data[n] = a0 - (a1 * Math::cos((TWO_PI * n)/(size - 1))) + (a2 * Math::cos((FOUR_PI * n)/(size - 1)))
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/spcore/windows/blackman_window.rb', line 5

def data
  @data
end