Skip to content

Instantly share code, notes, and snippets.

View CalvinLogan's full-sized avatar

Calvin CalvinLogan

View GitHub Profile
//inputs
int slidePin = A2;
int potPin1 = A1;
int potPin2 = A0;
int buttonPin = 12;
//outputs
int LEDR1 = 11;
int LEDR2 = 10;
int LEDR3 = 9;
def drawShape(eventType, channel, data1, data2):
global window, shape1, shape2, shape3, shape4, shape5, shape6
# iicon position is random
x = randint(0, getScreenWidth()) # x may be anywhere on display
y = randint(0, getScreenHeight()) # y may be anywhere on display
colors = ["Red", "Orange", "Yellow", "Green", "Blue", "Purple", "Pink", "White", "Teal"]
from gui import *
from timer import *
import time
b = True
def updateColor(shape):
while b:
for count in range(0,3):
#From red (255,0,0) to blue (0,0,255)
def setUp():
global window
window = Display("Visualizer", getScreenWidth(), getScreenHeight())
gradient = Rectangle(0, 0, getScreenWidth(), getScreenHeight(), Color.BLACK, True, 1)
window.add(gradient)
updateColor(gradient)
#input: None
#return: the width of the screen
from gui import *
from random import *
from music import *
from midi import *
from timer import *
import time
def setUp():
global window
window = Display("Visualizer", getScreenWidth(), getScreenHeight())
colors = ["Red", "Orange", "Yellow", "Green", "Blue", "Pink", "White", "Turqoise"]
colorIdx = (data / 2) % 12
color = colors[colorIdx]
shapeLists = [Shape1, Shape2, Shape3, Shape4, Shape5, Shape6, Shape7]
shapeListIdx = data / 12
shapeList = shapeLists[shapeListIdx]
shape = shapeList[color]
# Loops through the score, part, and phrase to make a list of all the notes
def getNotes():
global parts, notes, phrases, score
parts = score.getPartList()
for part in parts:
for phrase in part.getPhraseList():
phrases.append(phrase)
for note in phrase.getNoteList():
notes.append(note)
d = note.getDuration()
#dictonaries of notes
a = [9,21,33,45,57,69,81,93,105,117]
aS = [10,22,34,46,58,70,82,94,106,118]
aF = [8,20,32,44,56,68,80,92,104,116]
b = [11,23,35,47,59,71,83,95,107,119]
bS =[12,24,36,48,72,84,96,108,120]
c = [0,12,24,36,48,72,84,96,108,120]
cS = [1,13,25,37,49,61,73,85,97,109,121]
d = [26,38,50,62,74,86,98,110,122]
import os
import gui
from gui import *
#input: none
#return: the width of the screen
def getScreenWidth():
return Toolkit.getDefaultToolkit().getScreenSize().width
#input: none