almost finished gelb

This commit is contained in:
Kieran McAuliffe 2025-09-09 10:16:11 +02:00
parent f5c6e36d05
commit 1a07709d39

View File

@ -18,7 +18,9 @@ args = parser.parse_args()
client = udp_client.SimpleUDPClient(args.ip, args.port) client = udp_client.SimpleUDPClient(args.ip, args.port)
angle = 0 angle = 0
magnitude = 20 magnitude = 0
mean = 74.1
for msg in mid.tracks[1]: for msg in mid.tracks[1]:
t = mido.tick2second(msg.time, mid.ticks_per_beat, 1000000) t = mido.tick2second(msg.time, mid.ticks_per_beat, 1000000)
@ -27,13 +29,11 @@ for msg in mid.tracks[1]:
rotation = 2 * math.pi * beats / 16 rotation = 2 * math.pi * beats / 16
angle += rotation angle += rotation
magnitude += beats magnitude += beats * 3
if msg.type != "note_on": if msg.type != "note_on" or msg.time == 0:
continue continue
print(angle) adj_angle = angle + (msg.note - mean) / 9
print(magnitude) y = math.sin(adj_angle) * magnitude
x = math.cos(adj_angle) * magnitude
y = math.sin(angle) * magnitude client.send_message("/tcp_coordinates", (x, y, 6, 0, 0, 0))
x = math.cos(angle) * magnitude
client.send_message("/tcp_coordinates", (x, y, 10, 0, 0, 0))