Skip to content

Show MIDI markers in the piano roll #69

Answered by cifkao
aik2mlj asked this question in Q&A
Discussion options

You must be logged in to vote

The piano roll is rendered via an SVG element, so as soon as it's initialized, you should be able to add any additional graphical elements you want. You should be able to compute the x coordinate of your marker by taking its time in seconds and multiplying it by pixelsPerTimeStep, which is 30 by default.

You can see how I added a grid as a background to the piano roll here (via pure CSS – I simply added a background gradient that repeats every 30 pixels).

As far as loading the markers from the MIDI file: @magenta/music loads only notes, control changes and some basic meta messages like tempo, but does not seem to load markers (see the midiToSequenceProto function). So you would need to lo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by aik2mlj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants