Sha256: f400b18e98e0b8ce9e06ed0844842e940272087dde5c73542b7b11aa25a402c8
Contents?: true
Size: 530 Bytes
Versions: 9
Compression:
Stored size: 530 Bytes
Contents
module SPCore # Produces a Blackman-Harris window of a given size (number of samples). # For more info, see https://en.wikipedia.org/wiki/Window_function#Blackman.E2.80.93Harris_window. class BlackmanHarrisWindow attr_reader :data def initialize size @data = Array.new(size) a0, a1, a2, a3 = 0.35875, 0.48829, 0.14128, 0.01168 size.times do |n| @data[n] = a0 - a1 * Math::cos((TWO_PI * n)/(size - 1)) + a2 * Math::cos((FOUR_PI * n)/(size - 1)) - a3 * Math::cos((SIX_PI * n)/(size - 1)) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems