any way to tap into other magenta settings ie, quantize? #46
-
I'm loving what you've done with this! Thanks so much for putting this out there. I created a simple melody in MuseScore (All notes were entered using the mouse so weren't played in) and exported it as a midi file. In MuseScore it principally contains quarter and eighth notes with only one sixteenth note. When I load that midi file and use the visualizer "staff" type, I see this... I zoomed the page to show that each quarter note is converted into a dotted eighth and a 64th note rest. Here's what I see in MuseScore for the first two bars... I noticed that your Visualizer and Player element classes extend the HTMLElement and I see that the noteSequence is a Magenta note sequence. Magenta is a bit of a beast but I wondered if there might be away to tap into more of the Magenta sequence class settings? I wondered if use a quantize setting might resolve that issue. Thanks again for the library! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Yes, you can take a The player cannot really work with quantized sequences (with integer time steps) directly, but you should be able to use As for how to actually access all the Magenta functions, if you are using the Magenta bundle in your page as suggested in the readme, the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply! Didn't know that the core module was exposed in that way. Very helpful! |
Beta Was this translation helpful? Give feedback.
-
I found out that MuseScore exports midi with those shortened note values even though they show to be full quarter notes, etc. Used this to see what was happening. https://tonejs.github.io/Midi/ |
Beta Was this translation helpful? Give feedback.
-
Hello! To try to understand this quantize problem, I made this function called on load the dom: function htmlMidiPlayer(midiFile) {
} When i did'nt quantize (comment the two line calling the function quantize) the visualizer staff displaying : When i quantize the note with my code, it's much better, i got this: But it is difficult to find the right values to have a better placement of notes here it is simple because we have only white dotted notes, but when you have quavers or triplets, it is impossible to understand how to do to have the best quantize value. |
Beta Was this translation helpful? Give feedback.
Yes, you can take a
NoteSequence
(either you retrieve it fromplayer.noteSequence
or you load it yourself usingurlToNoteSequence
), manipulate it in any way you want, then assign the result toplayer.noteSequence
.The player cannot really work with quantized sequences (with integer time steps) directly, but you should be able to use
unquantizeSequence
to convert a quantized sequence back to a "normal" one that the player supports.As for how to actually access all the Magenta functions, if you are using the Magenta bundle in your page as suggested in the readme, the
@magenta/music/core
module will be loaded simply under the namecore
. So you can call e.g.core.sequences.quantizeNoteSequence
.