Class: AudioStream::Fx::Tremolo
- Inherits:
-
Object
- Object
- AudioStream::Fx::Tremolo
- Defined in:
- lib/audio_stream/fx/tremolo.rb
Instance Method Summary collapse
-
#initialize(soundinfo, freq:, depth:) ⇒ Tremolo
constructor
A new instance of Tremolo.
- #process(input) ⇒ Object
Constructor Details
Instance Method Details
#process(input) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/audio_stream/fx/tremolo.rb', line 14 def process(input) window_size = input.window_size streams = input.streams.map {|stream| stream.map.with_index {|f, i| f * (1.0 + @depth * Math.sin((i + @phase) * @period)) } } @phase = (@phase + window_size) % (window_size / @period) Buffer.new(*streams) end |