Class: SynthBlocks::Fx::Diffuser
- Inherits:
-
Object
- Object
- SynthBlocks::Fx::Diffuser
- Defined in:
- lib/synth_blocks/fx/g_verb.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(size, coeff) ⇒ Diffuser
constructor
A new instance of Diffuser.
- #run(x) ⇒ Object
Constructor Details
#initialize(size, coeff) ⇒ Diffuser
Returns a new instance of Diffuser.
61 62 63 64 65 66 67 |
# File 'lib/synth_blocks/fx/g_verb.rb', line 61 def initialize(size, coeff) @size = size.floor @coeff = coeff @idx = 0 @buf = Array.new(@size) @buf = @buf.map { |e| 0.0 } end |
Instance Method Details
#run(x) ⇒ Object
69 70 71 72 73 74 75 |
# File 'lib/synth_blocks/fx/g_verb.rb', line 69 def run(x) w = x - @buf[@idx] * @coeff; y = @buf[@idx] + w * @coeff; @buf[@idx] = w @idx = (@idx + 1) % @size; y end |