Class: Synthesizer::OscillatorSource::Pulse

Inherits:
Square
  • Object
show all
Includes:
Singleton
Defined in:
lib/synthesizer/oscillator_source/pulse.rb

Defined Under Namespace

Classes: Context

Instance Method Summary collapse

Constructor Details

#initializePulse

Returns a new instance of Pulse.



6
7
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 6

def initialize
end

Instance Method Details

#generate_context(soundinfo, note_perform, init_phase) ⇒ Object



16
17
18
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 16

def generate_context(soundinfo, note_perform, init_phase)
  Context.new(soundinfo, note_perform, init_phase)
end

#sample(context, phase) ⇒ Object



9
10
11
12
13
14
# File 'lib/synthesizer/oscillator_source/pulse.rb', line 9

def sample(context, phase)
  val = super(context, phase)
  result = context.prev<0.0 && 0.0<val ? 1.0 : 0.0
  context.prev = val
  result
end