Class: Wavify::DSP::Effects::Expander

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

Overview

Downward expander that reduces low-level material below a threshold.

Constant Summary

Constants inherited from EffectBase

Wavify::DSP::Effects::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,, ratio: 2.0, floor: -80.0,, attack: 0.001, hold: 0.02, release: 0.05, gain_attack: 0.001, gain_release: 0.05) ⇒ Expander

Returns a new instance of Expander.

Parameters:

  • threshold: (Numeric) (defaults to: -40.0,)
  • ratio: (Numeric) (defaults to: 2.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: 0.001)
  • gain_release: (Numeric) (defaults to: 0.05)


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

def initialize(threshold: -40.0, ratio: 2.0, floor: -80.0, attack: 0.001, hold: 0.02, release: 0.05,
               gain_attack: 0.001, gain_release: 0.05)
  super()
  @threshold_db = validate_dbfs!(threshold, :threshold)
  @ratio = validate_ratio!(ratio)
  @floor_db = validate_dbfs!(floor, :floor)
  @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