Class: Synthesizer::Filter::LowShelfFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/synthesizer/filter/low_shelf_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(freq:, q: DEFAULT_Q, gain: 1.0) ⇒ LowShelfFilter

Returns a new instance of LowShelfFilter.



4
5
6
7
8
# File 'lib/synthesizer/filter/low_shelf_filter.rb', line 4

def initialize(freq:, q: DEFAULT_Q, gain: 1.0)
  @freq = ModulationValue.create(freq)
  @q = ModulationValue.create(q)
  @gain = ModulationValue.create(gain)
end

Instance Method Details

#generator(note_perform, samplecount) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/synthesizer/filter/low_shelf_filter.rb', line 10

def generator(note_perform, samplecount)
  soundinfo = note_perform.synth.soundinfo
  filter = AudioStream::Fx::LowShelfFilter.new(soundinfo)

  freq_mod = ModulationValue.balance_generator(note_perform, samplecount, @freq)
  q_mod = ModulationValue.balance_generator(note_perform, samplecount, @q)
  gain_mod = ModulationValue.balance_generator(note_perform, samplecount, @gain)

  -> {
    filter.update_coef(freq: freq_mod[], q: q_mod[], gain: gain_mod[])
    filter
  }
end