Sha256: fe04234abdc49e972ade0b05a3555a4927ae99a41844e2e027bd0664fc801098
Contents?: true
Size: 490 Bytes
Versions: 9
Compression:
Stored size: 490 Bytes
Contents
module SPCore # Produces a Blackman window of a given size (number of samples). # For more info, see https://en.wikipedia.org/wiki/Window_function#Blackman_windows. class BlackmanWindow attr_reader :data 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 end end
Version data entries
9 entries across 9 versions & 1 rubygems