Method: AudioStream::Fx::NoiseGate#process
- Defined in:
- lib/audio_stream/fx/noise_gate.rb
#process(input) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/audio_stream/fx/noise_gate.rb', line 9 def process(input) window_size = input.window_size channels = input.channels # fft na = @window.process(input).to_float_na fft = FFTW3.fft(na, FFTW3::FORWARD) / na.length # noise gate fft.size.times {|i| if @threshold <= fft[i].abs fft[i] = 0i end } wet_na = FFTW3.fft(fft, FFTW3::BACKWARD) noise = Buffer.from_na(wet_na) input - noise end |