Class: SynthBlocks::Fx::AttRelEnvelope
- Inherits:
-
Object
- Object
- SynthBlocks::Fx::AttRelEnvelope
- Defined in:
- lib/synth_blocks/fx/compressor.rb
Overview
:nodoc:
Instance Method Summary collapse
- #attack=(attack) ⇒ Object
-
#initialize(srate, attack:, release:) ⇒ AttRelEnvelope
constructor
A new instance of AttRelEnvelope.
- #release=(decay) ⇒ Object
- #run(input, state) ⇒ Object
Constructor Details
#initialize(srate, attack:, release:) ⇒ AttRelEnvelope
Returns a new instance of AttRelEnvelope.
27 28 29 30 |
# File 'lib/synth_blocks/fx/compressor.rb', line 27 def initialize(srate, attack:, release:) @attack = EnvelopeDetector.new(srate, tc: attack) @release = EnvelopeDetector.new(srate, tc: release) end |
Instance Method Details
#attack=(attack) ⇒ Object
32 33 34 |
# File 'lib/synth_blocks/fx/compressor.rb', line 32 def attack=(attack) @attack.tc = attack end |
#release=(decay) ⇒ Object
36 37 38 |
# File 'lib/synth_blocks/fx/compressor.rb', line 36 def release=(decay) @release.tc = decay end |
#run(input, state) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/synth_blocks/fx/compressor.rb', line 40 def run(input, state) if input > state @attack.run( input, state ) else @release.run( input, state ) end end |