Sha256: c59af07784b68e5aa8236189e27599eb542be6f13f63ed989ca02872e279529c

Contents?: true

Size: 365 Bytes

Versions: 9

Compression:

Stored size: 365 Bytes

Contents

module SPCore
# Produces a Hann window of a given size (number of samples).
# For more info, see https://en.wikipedia.org/wiki/Window_function#Hann_.28Hanning.29_window.
class HannWindow
  attr_reader :data
  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
end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spcore-0.2.1 lib/spcore/windows/hann_window.rb
spcore-0.2.0 lib/spcore/windows/hann_window.rb
spcore-0.1.9 lib/spcore/windows/hann_window.rb
spcore-0.1.8 lib/spcore/windows/hann_window.rb
spcore-0.1.7 lib/spcore/windows/hann_window.rb
spcore-0.1.6 lib/spcore/windows/hann_window.rb
spcore-0.1.5 lib/spcore/windows/hann_window.rb
spcore-0.1.4 lib/spcore/windows/hann_window.rb
spcore-0.1.3 lib/spcore/windows/hann_window.rb