Sha256: 0eec2fe68da87be41ed143c829339e7646bf81d2d88a68ba86696f93981943f6
Contents?: true
Size: 467 Bytes
Versions: 9
Compression:
Stored size: 467 Bytes
Contents
module SPCore # Produces a Bartlett-Hann window of a given size (number of samples). # For more info, see https://en.wikipedia.org/wiki/Window_function#Bartlett.E2.80.93Hann_window. class BartlettHannWindow attr_reader :data def initialize size @data = Array.new(size) a0, a1, a2 = 0.62, 0.48, 0.38 size.times do |n| @data[n] = a0 - (a1 * ((n.to_f / (size - 1)) - 0.5).abs) - (a2 * Math::cos((TWO_PI * n)/(size - 1))) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems