Class: AudioStream::Fx::HanningWindow

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/audio_stream/fx/hanning_window.rb

Instance Method Summary collapse

Instance Method Details

#process(input) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/audio_stream/fx/hanning_window.rb', line 6

def process(input)
  streams = input.streams.map {|stream|
    stream * self.window(input.window_size)
  }

  Buffer.new(*streams)
end

#window(size) ⇒ Object



14
15
16
17
# File 'lib/audio_stream/fx/hanning_window.rb', line 14

def window(size)
  @window ||= {}
  @window[size] ||= Vdsp::DoubleArray.hann_window(size, Vdsp::FULL_WINDOW)
end