Newer
Older
synths: List[bl00mbox.patches.tinysynth] = []
def highlight_bottom_petal(num: int, r: int, g: int, b: int) -> None:
def change_playing_field_color(r: int, g: int, b: int) -> None:
highlight_bottom_petal(0, r, g, b)
highlight_bottom_petal(1, r, g, b)
highlight_bottom_petal(3, r, g, b)
highlight_bottom_petal(4, r, g, b)
leds.set_rgb(18, 55, 0, 55)
leds.set_rgb(19, 55, 0, 55)
leds.set_rgb(27, 55, 0, 55)
leds.set_rgb(28, 55, 0, 55)
leds.update()
if octave == -1:
change_playing_field_color(0, 0, 55)
elif octave == 0:
change_playing_field_color(0, 27, 27)
elif octave == 1:
change_playing_field_color(0, 55, 0)
petal = input.captouch.petals[i].whole
if petal.down:
any_down = True
k -= 10
k = 3 - k
note = scale[k] + 12 * octave
synths[0].signals.pitch.tone = note
synths[0].signals.trigger.start()
synth = blm.new(bl00mbox.patches.tinysynth)
synth.signals.output = blm.mixer
synths += [synth]
from st3m.application import Application, ApplicationContext
class MelodicApp(Application):
def __init__(self, app_ctx: ApplicationContext) -> None:
super().__init__(app_ctx)
def draw(self, ctx: Context) -> None:
ctx.rgb(1, 1, 1).rectangle(-120, -120, 240, 240).fill()
ctx.rgb(0, 0, 0)
def on_enter(self, vm: Optional[ViewManager]) -> None:
foreground()
def think(self, ins: InputState, delta_ms: int) -> None:
super().think(ins, delta_ms)