From 06524577fffdf759c35423e6fc774c62e1db240c Mon Sep 17 00:00:00 2001 From: Kieran McAuliffe Date: Tue, 30 Sep 2025 11:13:50 +0200 Subject: [PATCH] finished gelb --- music_tracker.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/music_tracker.py b/music_tracker.py index 03b2cf9..03e404b 100644 --- a/music_tracker.py +++ b/music_tracker.py @@ -20,20 +20,22 @@ client = udp_client.SimpleUDPClient(args.ip, args.port) angle = 0 magnitude = 0 mean = 74.1 +client.send_message("/color", "yellow") for msg in mid.tracks[1]: t = mido.tick2second(msg.time, mid.ticks_per_beat, 1000000) beats = msg.time / mid.ticks_per_beat - time.sleep(t) rotation = 2 * math.pi * beats / 16 angle += rotation magnitude += beats * 3 if msg.type != "note_on" or msg.time == 0: + time.sleep(t) continue - + print(msg.note) adj_angle = angle + (msg.note - mean) / 9 y = math.sin(adj_angle) * magnitude x = math.cos(adj_angle) * magnitude client.send_message("/tcp_coordinates", (x, y, 6, 0, 0, 0)) + time.sleep(t)