Class: SynthBlocks::Fx::Waveshaper
- Inherits:
-
Object
- Object
- SynthBlocks::Fx::Waveshaper
- Defined in:
- lib/synth_blocks/fx/waveshaper.rb
Overview
waveshaper, source www.musicdsp.org/en/latest/Effects/41-waveshaper.html amount can go from 1 to … oo the higher a the stronger is the distortion
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Waveshaper amount.
Instance Method Summary collapse
-
#initialize(amount) ⇒ Waveshaper
constructor
Create waveshaper instance [amount] Amount can be from 0 to oo.
-
#run(input) ⇒ Object
run waveshaper.
Constructor Details
#initialize(amount) ⇒ Waveshaper
Create waveshaper instance
- amount
-
Amount can be from 0 to oo
14 15 16 |
# File 'lib/synth_blocks/fx/waveshaper.rb', line 14 def initialize(amount) @amount = amount end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Waveshaper amount
10 11 12 |
# File 'lib/synth_blocks/fx/waveshaper.rb', line 10 def amount @amount end |
Instance Method Details
#run(input) ⇒ Object
run waveshaper
19 20 21 |
# File 'lib/synth_blocks/fx/waveshaper.rb', line 19 def run(input) input * (input.abs + amount) / (input ** 2 + (amount - 1) * input.abs + 1) end |