Class: Synthesizer::Filter::HighPassFilter

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

Instance Method Summary collapse

Constructor Details

#initialize(freq:, q: DEFAULT_Q) ⇒ HighPassFilter

Returns a new instance of HighPassFilter.



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

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

Instance Method Details

#generator(note_perform, samplecount) ⇒ Object



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

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

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

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