oscillators¶
- class Oscillator(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None)¶
Bases:
object
- Parameters
freq (float) – Frequency in Hz of the oscillator
gain (float) – Gain from 0.0 to 1.0 of the oscillator, applied after processing
offset (float) – DC offset of signal, applied after processing
gainct – A node that will control the oscillator gain on a sample by sample basis. Type is a class with a get_sample method which takes a time in seconds and returns a PCM sample value
fmct – An array of nodes that will control the oscillator frequency on a sample by sample basis. Type is a class with a get_sample method which takes a time in seconds and returns a PCM sample value
- Variables
phi (float) – Current phase offset of the oscillator
- gain_to(gain)¶
- Parameters
gain (float) – The gain which the oscillator should be adjusted to
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float
- get_sample(time)¶
- Parameters
time (float) – The time in seconds of which the sample should be gotten
- Returns
A PCM value for the oscillator at a given time that has been adjusted with gain and offset
- Return type
float
- class Random(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None)¶
Bases:
py_modular.sound.oscillators.Oscillator
- Variables
time_period (float) – The time in seconds it takes to move from one random value to the next
start_time (float) – The time in seconds at which the last cycle started
start_value (float) – The value that the oscillator moves from during a cycle
end_value (float) – The value that the oscillator moves to during a cycle
range (float) – The difference of end_value and start_value
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float
- start_cycle(time)¶
- Parameters
time (float) – A value of time in seconds
- class Saw(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None)¶
Bases:
py_modular.sound.oscillators.Oscillator
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float
- class Sine(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None)¶
Bases:
py_modular.sound.oscillators.Oscillator
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float
- class Square(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None, pwmct=None)¶
Bases:
py_modular.sound.oscillators.Oscillator
- Parameters
pwmct – A node which has a get_sample method which, given a value of time in seconds, returns a pcm value for that time
- Variables
th (float) – The threshold of determining a high or low of the square wave
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float
- class Tri(freq=100.0, gain=1.0, offset=0.0, gainct=None, fmct=None)¶
Bases:
py_modular.sound.oscillators.Oscillator
- get_pcm_value(time)¶
- Parameters
time (float) – The time in seconds of which the PCM value should be gotten for
- Returns
A PCM value for the oscillator at a given time
- Return type
float