From 0fb3684ec22a0853a987485fbe3addcc1d9588d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Tue, 14 Dec 2021 14:40:25 +0100 Subject: [PATCH] hope --- main.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index e741971..728ab76 100644 --- a/main.py +++ b/main.py @@ -65,17 +65,35 @@ async def printing(data): await asyncio.sleep(data['duration'] / 1000) print(f"end of {data['key']}") + +def midi_key_my_key(midi_key): + keys = list(notePixels.keys()).reverse() + + return keys[midi_key - 48] + + + + async def main(): default_duration = 900 default_color = (255, 0, 0) + notes = [] + for msg in MidiFile('new_song_1.mid'): + d = msg.dict() + notes.append(int(d.time * 1000), {"duration": 200, "color": default_color, "key": midi_key_my_key(d.note)}) print(msg) p = Partition("test", - [ + notes + ) + + """ + + [ Note(000, {"duration": default_duration, "color": default_color, "key": "sol"}), Note(1000, {"duration": default_duration, "color": default_color, "key": "sol"}), Note(2000, {"duration": default_duration, "color": default_color, "key": "sol"}), @@ -95,7 +113,7 @@ async def main(): Note(15000, {"duration": default_duration, "color": default_color, "key": "la#"}), ] - ) + """ await p.play(to_chroma_case)