-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLivecodeexampleII.py
More file actions
154 lines (115 loc) · 4.27 KB
/
LivecodeexampleII.py
File metadata and controls
154 lines (115 loc) · 4.27 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#Starter Code
import neoscore
import math
from threading import Timer
import time
import random
from random import *
import threading
#from helpers import render_example
from neoscore.core import neoscore
from neoscore.core.flowable import Flowable
from neoscore.core.units import ZERO, Mm
from neoscore.western.clef import Clef
from neoscore.western.duration import Duration
from neoscore.western.key_signature import KeySignature
from neoscore.western.notehead import Notehead
from neoscore.western.staff import Staff
from neoscore.western.chordrest import Chordrest
from neoscore.core.color import ColorDef
from neoscore.core.color import Color
from neoscore.core.path import Path
from neoscore.core.brush import Brush
from neoscore.core.neoscore import set_background_brush
neoscore.setup()
flowable = Flowable((Mm(0), Mm(0)), None, Mm(500), Mm(30), Mm(10))
staff = Staff((Mm(0), Mm(0)), flowable, Mm(500))
unit = staff.unit
clef = Clef(ZERO, staff, "treble")
KeySignature(ZERO, staff, "g_major")
center = unit(15)
n1 = Chordrest(ZERO, staff, ["c"], (1, 8))
n2 = Chordrest(Mm(35), staff, ["e"], (2, 16))
n3 = Chordrest(Mm(50), staff, ["g"], (3, 4))
n4 = Chordrest(Mm(65), staff, ["a"], (4, 2))
#snippet III
n1.noteheads[0].brush = Brush("#000000")
n2.noteheads[0].brush = Brush("#000000")
n3.noteheads[0].brush = Brush("#000000")
n4.noteheads[0].brush = Brush("#000000")
colorselect = [ "#f5f5f5", "ebebeb", "e0e0e0", "d6d6d6", "cccccc", "c2c2c2", "b8b8b8", "adadad", "a3a3a3", "999999", "858585",
"7a7a7a", "707070", "666666", "5c5c5c", "525252", "474747", "3d3d3d", "333333", "292929", "1f1f1f", "141414", "0a0a0a", "000000"]
#snippet VI
def colorchange0():
brush = set_background_brush(colorselect[0])
def colorchange1():
brush1 = set_background_brush(colorselect[1])
def colorchange2():
brush2 = set_background_brush(colorselect[2])
def colorchange3():
brush3 = set_background_brush(colorselect[3])
def colorchange4():
brush4 = set_background_brush(colorselect[4])
def colorchange5():
brush5 = set_background_brush(colorselect[5])
def colorchange6():
brush6 = set_background_brush(colorselect[6])
def colorchange7():
brush7 = set_background_brush(colorselect[7])
def colorchange8():
brush8 = set_background_brush(colorselect[8])
def colorchange9():
brush9 = set_background_brush(colorselect[9])
def colorchange10():
brush10 = set_background_brush(colorselect[10])
def colorchange11():
brush11 = set_background_brush(colorselect[11])
def colorchange12():
brush12 = set_background_brush(colorselect[12])
def colorchange13():
brush13 = set_background_brush(colorselect[13])
def colorchange14():
brush14 = set_background_brush(colorselect[14])
def colorchange15():
brush15 = set_background_brush(colorselect[15])
def colorchange16():
brush16 = set_background_brush(colorselect[16])
def colorchange17():
brush17 = set_background_brush(colorselect[17])
def colorchange18():
brush18 = set_background_brush(colorselect[18])
def colorchange19():
brush19 = set_background_brush(colorselect[19])
def colorchange20():
brush20 = set_background_brush(colorselect[20])
def colorchange21():
brush21 = set_background_brush(colorselect[21])
def colorchange22():
brush22 = set_background_brush(colorselect[22])
def colorchange23():
brush23 = set_background_brush(colorselect[23])
t = threading.Timer(1, colorchange0)
t1 = threading.Timer(2, colorchange1)
t2 = threading.Timer(3, colorchange2)
t3 = threading.Timer(4, colorchange3)
t4 = threading.Timer(5, colorchange4)
t5 = threading.Timer(6, colorchange5)
t6 = threading.Timer(7, colorchange6)
t7 = threading.Timer(8, colorchange7)
t8 = threading.Timer(9, colorchange8)
t9 = threading.Timer(10, colorchange9)
t10 = threading.Timer(11, colorchange10)
t11 = threading.Timer(12, colorchange11)
t12 = threading.Timer(13, colorchange12)
t13 = threading.Timer(14, colorchange13)
t14 = threading.Timer(15, colorchange14)
t15 = threading.Timer(16, colorchange15)
t16 = threading.Timer(17, colorchange16)
t17 = threading.Timer(18, colorchange17)
t18 = threading.Timer(19, colorchange18)
t19 = threading.Timer(20, colorchange19)
t20 = threading.Timer(21, colorchange20)
t21 = threading.Timer(22, colorchange21)
t22 = threading.Timer(23, colorchange22)
t23 = threading.Timer(24, colorchange23)
neoscore.show()