Mehr Akkorde

This commit is contained in:
Zoredh 2019-02-06 21:00:45 +01:00
parent 1dd5235944
commit 5283b64651

21
hero.py
View file

@ -41,10 +41,15 @@ CHORDS = {
}
MAP = {
1:"C",
2:"D",
4:"Em",
8:"G"
16:"G",
64:"Em",
128:"C",
32:"D",
4:"Am",
80:"F",
192:"E",
160:"B",
36:"A"
}
# Hilfsfunktionen fuer die Bit-Manipulation (PRESSED)
@ -65,6 +70,8 @@ def proc_event(event,midi_out):
exit(0)
elif event.type == JOYAXISMOTION:
print("axis %d value %0.3f" % (event.axis, event.value))
print PRESSED
try:
if event.value > 0.2 or event.value < -0.2:
if PRESSED > 0:
CHORD = MAP[PRESSED]
@ -81,11 +88,13 @@ def proc_event(event,midi_out):
if NOTE > (-1):
print MOF[i]+NOTE
midi_out.note_on(MOF[i]+NOTE+CAPO,127)
clock.tick(50)
#clock.tick(50)
else:
#print "X"
pass
i += j
except:
pass
elif event.type == JOYBUTTONDOWN:
try:
#print("button %d down." % event.button)
@ -145,7 +154,7 @@ def main():
while 1:
try:
# 5 Millisekunden warten, bevor das Dingens hier weiterlaeuft
clock.tick(5)
clock.tick(50)
for event in pygame.event.get():
proc_event(event,midi_out)
except KeyboardInterrupt: