-
Notifications
You must be signed in to change notification settings - Fork 0
/
Oscillators.py
53 lines (36 loc) · 1.13 KB
/
Oscillators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import numpy as np
import cv2
import cv
from Gen import Gen
class Osc(Gen):
def __init__(self, name):
Gen.__init__(self, name)
self.attrs['freq'] = 220.0
self.attrs['phase'] = 0.0
self.attrs['sync'] = 2.0
def update_attrs(self, updates = {}):
for attr_type in updates:
if attr_type in self.attrs:
self.attrs[attr_type] = updates[attr_type]
class Phasor(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
class SinOsc(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
class PulsOsc(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
self.attrs['width'] = 0.5
class SqrOsc(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
self.attrs['width'] = 0.5
class TriOsc(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
self.attrs['width'] = 0.5
class SawOsc(Osc):
def __init__(self):
Osc.__init__(self, self.__class__.__name__)
self.attrs['width'] = 1.0