show midi input on screen using Music21

15 views
Skip to first unread message

Áron Boros

unread,
Mar 10, 2023, 10:14:20 PM3/10/23
to music21
Hi all,

I feel like this should be easy -- but the solutions I've found feel wrong.  I'd like to connect my mac to a midi device (a keyboard), then display the notes being played in real-time. (one note or chord at a time -- whatever keys are depressed at any point in time)  

The only way I figured out how to do this was to use .write('musicxml.png') to save a PNG of the notes to a file, then load that png in a tkinter window.  But loading MuseScore and saving and reading the file is really slow -- not nearly fast enough to show the notes in real-time.  

Using LilyPond (.write('lily.png')) was a little bit faster but still took maybe half a second to update.  

I could manually draw the staff and notes, which would be fast, but ugly and defeats the purpose of using music21.   (see https://www.101computing.net/music-score-using-python/

Is there a better way to do this?  Is Music21 not the right tool for this?  

Any thoughts would be much appreciated. 
Aron



Michael Scott Cuthbert

unread,
Mar 10, 2023, 10:55:58 PM3/10/23
to music21list
There are ways of doing this with music21, but you’ll find that the beta software music21j  (Javascript) works much better and way simpler for this (Music21’s not really a realtime MIDI tool).  There are already demo files on how to do exactly that in that software’s testHTML folder.

Best,
Myke


--
--
To Post: email music...@googlegroups.com
To Unsubscribe: email music21list...@googlegroups.com
Archives, Options, etc: http://groups.google.com/group/music21list

---
You received this message because you are subscribed to the Google Groups "music21" group.
To unsubscribe from this group and stop receiving emails from it, send an email to music21list...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/music21list/bb46b01e-afae-4fd5-9dc9-6b448e49f97cn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages