documentation, cleanup

This commit is contained in:
Mikayla Dobson
2023-04-10 17:12:21 -05:00
parent 212bf11216
commit 4c91814545
3 changed files with 65 additions and 11 deletions

28
main.py
View File

@@ -1,8 +1,21 @@
# PICOSYNTH
# open source semi-modular synthesizer model
# developer: Mikayla Dobson
# github: github.com/innocuous-symmetry
""" " " " " " " " " " " " " " " " " " " " " " "
IMPORTS
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
from machine import Pin, ADC, PWM from machine import Pin, ADC, PWM
from random import randint from random import randint
from math import floor, ceil from math import floor, ceil
from time import sleep from time import sleep
""" " " " " " " " " " " " " " " " " " " " " " "
CONSTANTS
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
__SYSTEM_PWM_FREQUENCY__ = 1000 __SYSTEM_PWM_FREQUENCY__ = 1000
HIGH = 65535 HIGH = 65535
@@ -80,6 +93,9 @@ SYNTH_CONFIG = {
} }
} }
""" " " " " " " " " " " " " " " " " " " " " " "
INDEPENDENT FUNCTIONS FOR TESTING, COMMON USE CASES
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
def blink(controller: type[ADC], target=Pin(25, Pin.OUT), sleep_duration = 1000): def blink(controller: type[ADC], target=Pin(25, Pin.OUT), sleep_duration = 1000):
if not controller: pass if not controller: pass
@@ -98,7 +114,7 @@ def blink(controller: type[ADC], target=Pin(25, Pin.OUT), sleep_duration = 1000)
""" " " " " " " " " " " " " " " " " " " " " " " """ " " " " " " " " " " " " " " " " " " " " " "
" BEGIN CLASS DEFINITIONS FOR BASIC HARDWARE BEHAVIORS " CLASS DEFINITIONS FOR BASIC HARDWARE BEHAVIORS
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
# for representing and interacting with waveform data # for representing and interacting with waveform data
@@ -227,9 +243,19 @@ class Synthesizer:
def __init__(self, config): def __init__(self, config):
self.config = config self.config = config
""" " " " " " " " " " " " " " " " " " " " " " "
SYNTHESIZER DEFINITION AND PIN/COMPONENT ASSIGNMENTS
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
gate_out = PWMOutput(15, 0) gate_out = PWMOutput(15, 0)
voct_out = PWMOutput(16, 0) voct_out = PWMOutput(16, 0)
""" " " " " " " " " " " " " " " " " " " " " " "
START
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ """
while True: while True:
random_value = VOCT_PITCH_VALUES[randint(0, len(VOCT_PITCH_VALUES) - 1)] * 65535 random_value = VOCT_PITCH_VALUES[randint(0, len(VOCT_PITCH_VALUES) - 1)] * 65535
print(int(random_value)) print(int(random_value))

38
patch.py Normal file
View File

@@ -0,0 +1,38 @@
class Patch:
def __init__(self, config):
self.config = config
A_FORMAT_HARDWARE = {
"CV_IN": 4,
"CV_OUT": 4,
"ROTARY_ENCODER": True,
"POTENTIOMETER": 4,
"OLED": 1
}
B_FORMAT_HARDWARE = {
"CV_IN": 3,
"CV_OUT": 3,
"ROTARY_ENCODER": False,
"POTENTIOMETER": 3,
"OLED": 0.5
}
class AFormatPatch(Patch):
# expects to have hardware:
# 3x CV in
# 3x CV out
# 3x potentiometer
# half of OLED screen
def __init__(self):
super().__init__(self)
class BFormatPatch(Patch):
# expects to have hardware:
# 3x CV in
# 3x CV out
# 3x potentiometer
# half of OLED screen
def __init__(self):
super().__init__(self)

View File

@@ -1,10 +0,0 @@
{
"py_ignore": [
".vscode",
".gitignore",
".git",
"env",
"venv"
],
"name": "picosynth"
}