class SynthBlocks::Fx::Waveshaper

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

Attributes

amount[R]

Waveshaper amount

Public Class Methods

new(amount) click to toggle source

Create waveshaper instance

amount

Amount can be from 0 to oo

# File lib/synth_blocks/fx/waveshaper.rb, line 14
def initialize(amount)
  @amount = amount
end

Public Instance Methods

run(input) click to toggle source

run waveshaper

# File lib/synth_blocks/fx/waveshaper.rb, line 19
def run(input)
  input * (input.abs + amount) / (input ** 2 + (amount - 1) * input.abs + 1)
end