Skip to content

Commit 7d7c9c6

Browse files
Kushal SaharanKushal Saharan
authored andcommitted
Fixed a bug in lib.py
1 parent 5af68bf commit 7d7c9c6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

frets.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def start():
5656
# Change color space for better detection
5757
hsvframe = cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
5858
fingerImages = lib.filterFingers(hsvframe)
59-
# cv2.imshow('red', fingerImages[0])
60-
# cv2.imshow('green', fingerImages[1])
61-
# cv2.imshow('blue', fingerImages[2])
59+
cv2.imshow('red', fingerImages[0])
60+
cv2.imshow('green', fingerImages[1])
61+
cv2.imshow('blue', fingerImages[2])
6262

6363
fingerPositions = lib.getPositions(fingerImages)
6464

@@ -128,3 +128,5 @@ def start():
128128
if key == 27: #Ends the session and save the song. Press ESCAPE key
129129
play.save('muse', song, 0.05, [0, prevTime, 0.1])
130130
break
131+
132+
init()

lib.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,11 @@ def getPattern(mode,dist,direction):
159159
if note[1]+dist>11:
160160
pattern=pattern+notes_ar[note[0]+1][(note[1]+dist)%12]+' '
161161
else:
162-
pattern=pattern+notes_ar[note[0]][(note[1]+dist)%12]+' '
163-
print notes_ar[note[0]][(note[1]+dist)%12]
162+
try:
163+
pattern=pattern+notes_ar[note[0]][(note[1]+dist)%12]+' '
164+
except IndexError:
165+
return ''
166+
164167
if direction=='up':
165168
return pattern
166169
else:

0 commit comments

Comments
 (0)