Class: Wavify::DSP::Effects::NoiseGate

Inherits:
EffectBase
  • Object
show all
Defined in:
lib/wavify/dsp/effects/noise_gate.rb,
sig/effects.rbs

Overview

Simple downward gate for suppressing low-level noise.

Constant Summary

Constants inherited from EffectBase

EffectBase::TAIL_CHUNK_FRAMES

Instance Method Summary collapse

Methods inherited from EffectBase

#apply, #build_runtime, #flush, #latency, #lookahead, #process, #process_sample, #reset, #tail_duration

Constructor Details

#initialize(threshold: -40.0,, floor: -80.0,, attack: 0.001, hold: 0.02, release: 0.05, gain_attack: attack, gain_release: release) ⇒ NoiseGate

Returns a new instance of NoiseGate.

Parameters:

  • threshold: (Numeric) (defaults to: -40.0,)
  • floor: (Numeric) (defaults to: -80.0,)
  • attack: (Numeric) (defaults to: 0.001)
  • hold: (Numeric) (defaults to: 0.02)
  • release: (Numeric) (defaults to: 0.05)
  • gain_attack: (Numeric) (defaults to: attack)
  • gain_release: (Numeric) (defaults to: release)


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wavify/dsp/effects/noise_gate.rb', line 10

def initialize(threshold: -40.0, floor: -80.0, attack: 0.001, hold: 0.02, release: 0.05,
               gain_attack: attack, gain_release: release)
  super()
  @threshold_db = validate_dbfs!(threshold, :threshold)
  @floor_db = validate_dbfs!(floor, :floor)
  @threshold = db_to_amplitude(@threshold_db)
  @floor_gain = db_to_amplitude(@floor_db)
  @gain_attack = validate_time!(gain_attack, :gain_attack)
  @gain_release = validate_time!(gain_release, :gain_release)
  @envelope_follower = EnvelopeFollower.new(attack: attack, hold: hold, release: release)
  reset
end