Class: Synthesizer::Oscillator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source: OscillatorSource::Sine.instance, volume: 1.0, pan: 0.0, tune_semis: 0, tune_cents: 0, sym: 0, phase: nil, sync: 0, uni_num: 1.0, uni_detune: 0.0, uni_stereo: 0.0) ⇒ Oscillator

Returns a new instance of Oscillator.

Parameters:

  • source (Synthesizer::OscillatorSource) (defaults to: OscillatorSource::Sine.instance)

    oscillator waveform source

  • volume (ModulationValue | Float) (defaults to: 1.0)

    oscillator volume. mute=0.0 max=1.0

  • pan (ModulationValue | Float) (defaults to: 0.0)

    oscillator pan. left=-1.0 center=0.0 right=1.0 (-1.0~1.0)

  • tune_semis (ModulationValue | Integer) (defaults to: 0)

    oscillator pitch semitone

  • tune_cents (ModulationValue | Integer) (defaults to: 0)

    oscillator pitch cent

  • sym (nil) (defaults to: 0)

    TODO not implemented

  • phase (ModulationValue | Float) (defaults to: nil)

    oscillator waveform shape start phase percent (0.0~1.0,nil) nil=random

  • sync (ModulationValue | Integer) (defaults to: 0)

    oscillator sync pitch 1.0=semitone 12.0=octave (0.0~48.0)

  • uni_num (ModulationValue | Float) (defaults to: 1.0)

    oscillator voicing number (1.0~16.0)

  • uni_detune (ModulationValue | Float) (defaults to: 0.0)

    oscillator voicing detune percent. 0.01=1cent 1.0=semitone (0.0~1.0)

  • uni_stereo (ModulationValue | Float) (defaults to: 0.0)

    oscillator voicing spread pan. -1.0=full inv 0.0=mono 1.0=full (-1.0~1.0)



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/synthesizer/oscillator.rb', line 27

def initialize(source: OscillatorSource::Sine.instance, volume: 1.0, pan: 0.0, tune_semis: 0, tune_cents: 0, sym: 0, phase: nil, sync: 0, uni_num: 1.0, uni_detune: 0.0, uni_stereo: 0.0)
  @source = source

  @volume = ModulationValue.create(volume)
  @pan = ModulationValue.create(pan)
  @tune_semis = ModulationValue.create(tune_semis)
  @tune_cents = ModulationValue.create(tune_cents)

  @sym = ModulationValue.create(sym)
  @phase = ModulationValue.create(phase)
  @sync = ModulationValue.create(sync)

  @uni_num = ModulationValue.create(uni_num)
  @uni_detune = ModulationValue.create(uni_detune)
end

Instance Attribute Details

#panObject (readonly)

Returns the value of attribute pan.



6
7
8
# File 'lib/synthesizer/oscillator.rb', line 6

def pan
  @pan
end

#phaseObject (readonly)

Returns the value of attribute phase.



10
11
12
# File 'lib/synthesizer/oscillator.rb', line 10

def phase
  @phase
end

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'lib/synthesizer/oscillator.rb', line 4

def source
  @source
end

#symObject (readonly)

Returns the value of attribute sym.



9
10
11
# File 'lib/synthesizer/oscillator.rb', line 9

def sym
  @sym
end

#syncObject (readonly)

Returns the value of attribute sync.



11
12
13
# File 'lib/synthesizer/oscillator.rb', line 11

def sync
  @sync
end

#tune_centsObject (readonly)

Returns the value of attribute tune_cents.



8
9
10
# File 'lib/synthesizer/oscillator.rb', line 8

def tune_cents
  @tune_cents
end

#tune_semisObject (readonly)

Returns the value of attribute tune_semis.



7
8
9
# File 'lib/synthesizer/oscillator.rb', line 7

def tune_semis
  @tune_semis
end

#uni_detuneObject (readonly)

Returns the value of attribute uni_detune.



13
14
15
# File 'lib/synthesizer/oscillator.rb', line 13

def uni_detune
  @uni_detune
end

#uni_numObject (readonly)

Returns the value of attribute uni_num.



12
13
14
# File 'lib/synthesizer/oscillator.rb', line 12

def uni_num
  @uni_num
end

#uni_stereoObject (readonly)

Returns the value of attribute uni_stereo.



14
15
16
# File 'lib/synthesizer/oscillator.rb', line 14

def uni_stereo
  @uni_stereo
end

#volumeObject (readonly)

Returns the value of attribute volume.



5
6
7
# File 'lib/synthesizer/oscillator.rb', line 5

def volume
  @volume
end