| |
- abc.ABC
-
- Oscillator
-
- SawtoothOscillator
- SineOscillator
-
- SquareOscillator
- TriangleOscillator
class Oscillator |
|
Oscillator(frequency: float = 220.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
Oscillator is an abstract base class that implements common functionality for
concrete oscillator implementations.
Methods:
__init__: constructor
generate_wave: abstract method for generating wave
crop_samples: method for cropping wave |
|
- Method resolution order:
- Oscillator
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, frequency: float = 220.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
- Initialization for common oscillator properties
Extend to create a custom oscillator
Args:
frequency: the frequency of the oscillator (note)
sample_rate: the sample rate (combines with frequency to determine step size)
amplitude: the amplitude of the oscillator (volume)
duration: the duration of the oscillator (combines with sample rate to determine time)
- crop_samples(self, samples: numpy.ndarray) -> numpy.ndarray
- This function crops the samples to the final zero crossing,
so the end of a wave matches up with the beginning.
Side effects: final signal is very slightly shorter.
Args:
samples: wave to be trimmed
Returns:
a trimmed wave
- generate_wave(self) -> numpy.ndarray
- override to generate a wave from the settings established
upon construction.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
|
class SawtoothOscillator(Oscillator) |
|
SawtoothOscillator(frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
# SAW TOOTH OSCILLATOR |
|
- Method resolution order:
- SawtoothOscillator
- Oscillator
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
- Extends Oscillator.__init__
- generate_wave(self) -> numpy.ndarray
- Generates a sawtooth wave
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Oscillator:
- crop_samples(self, samples: numpy.ndarray) -> numpy.ndarray
- This function crops the samples to the final zero crossing,
so the end of a wave matches up with the beginning.
Side effects: final signal is very slightly shorter.
Args:
samples: wave to be trimmed
Returns:
a trimmed wave
Data descriptors inherited from Oscillator:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class SineOscillator(Oscillator) |
|
SineOscillator(frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
# SINE OSCILLATOR |
|
- Method resolution order:
- SineOscillator
- Oscillator
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
- Extends Oscillator.__init__
- generate_wave(self) -> numpy.ndarray
- Generates a sine wave
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Oscillator:
- crop_samples(self, samples: numpy.ndarray) -> numpy.ndarray
- This function crops the samples to the final zero crossing,
so the end of a wave matches up with the beginning.
Side effects: final signal is very slightly shorter.
Args:
samples: wave to be trimmed
Returns:
a trimmed wave
Data descriptors inherited from Oscillator:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class SquareOscillator(SineOscillator) |
|
SquareOscillator(frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
|
|
- Method resolution order:
- SquareOscillator
- SineOscillator
- Oscillator
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, frequency: float = 440.0, sample_rate: int = 48000, amplitude: float = 8191.75, duration: float = 1.0) -> None
- Extends Oscillator.__init__
- generate_wave(self) -> numpy.ndarray
- Generates a square wave
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Oscillator:
- crop_samples(self, samples: numpy.ndarray) -> numpy.ndarray
- This function crops the samples to the final zero crossing,
so the end of a wave matches up with the beginning.
Side effects: final signal is very slightly shorter.
Args:
samples: wave to be trimmed
Returns:
a trimmed wave
Data descriptors inherited from Oscillator:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
|