Class: Synthesizer::Filter::PeakingFilter
- Inherits:
-
Object
- Object
- Synthesizer::Filter::PeakingFilter
- Defined in:
- lib/synthesizer/filter/peaking_filter.rb
Instance Method Summary collapse
- #generator(note_perform, samplecount) ⇒ Object
-
#initialize(freq:, bandwidth: 1.0, gain: 40.0) ⇒ PeakingFilter
constructor
A new instance of PeakingFilter.
Constructor Details
#initialize(freq:, bandwidth: 1.0, gain: 40.0) ⇒ PeakingFilter
Returns a new instance of PeakingFilter.
4 5 6 7 8 |
# File 'lib/synthesizer/filter/peaking_filter.rb', line 4 def initialize(freq:, bandwidth: 1.0, gain: 40.0) @freq = ModulationValue.create(freq) @bandwidth = ModulationValue.create(bandwidth) @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/peaking_filter.rb', line 10 def generator(note_perform, samplecount) soundinfo = note_perform.synth.soundinfo filter = AudioStream::Fx::PeakingFilter.new(soundinfo) freq_mod = ModulationValue.balance_generator(note_perform, samplecount, @freq) bandwidth_mod = ModulationValue.balance_generator(note_perform, samplecount, @bandwidth) gain_mod = ModulationValue.balance_generator(note_perform, samplecount, @gain) -> { filter.update_coef(freq: freq_mod[], bandwidth: bandwidth_mod[], gain: gain_mod[]) filter } end |