diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index ce6a9b7..6302b43 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -223,8 +223,9 @@ const PlayView = ({ songId }: PlayViewProps) => { }; inputs.forEach((input) => { input.onmidimessage = (message) => { - const { command, note } = parseMidiMessage(message); - const keyIsPressed = command == 9; + const { command, note, velocity } = parseMidiMessage(message); + let keyIsPressed = command == 9; + if (velocity == 0) keyIsPressed = false; webSocket.current?.send( JSON.stringify({ diff --git a/scorometer/main.py b/scorometer/main.py index 7be6834..6cdf67e 100755 --- a/scorometer/main.py +++ b/scorometer/main.py @@ -207,9 +207,9 @@ class Scorometer: #self.keys_down.append((message.note, message.time)) self.keys_down_practice.add(message.note) if self.to_play == self.keys_down_practice: - self.send({"type": "step", "timestamp": self.practice_partition[0][0].start + 1}) if len(self.practice_partition) == 0: self.endGamePractice() + self.send({"type": "step", "timestamp": self.practice_partition[0][0].start + 1}) self.to_play = set([x.key for x in self.practice_partition.pop(0)]) ''' @@ -368,9 +368,9 @@ class Scorometer: send( { "type": "end", - #"overallScore": self.info["score"], - #"precision": round(((self.info["perfect"] + self.info["great"] + self.info["good"]) / (len(self.partition.notes) + self.info["wrong"]) * 100), 2), - #"score": self.info, + "overallScore": self.info["score"], + "precision": round(((self.info["perfect"] + self.info["great"] + self.info["good"]) / (len(self.partition.notes) + self.info["wrong"]) * 100), 2), + "score": self.info, } ) exit()