TLDR: I struggled to get magenta js to do much. I created the most basic example of using the music VAE + the web midi api, separately. It uses the “mel_4bar_small_q” model which is “A 4-bar, 90-class onehot melody model. Less accurate, but smaller in size than full model. Quantized to 2-byte weights.”
The most basic documentation for magenta.js can be found in the announcement blog post. There are some example apps here and a list of technical examples here but the full documentation is generally obtuse.
I wanted to create something that would allow me to spit out random generated sequences to my music hardware. I got going with the web midi api, but it took a while to discover the proper documentation: http://webaudio.github.io/web-midi-api/
Ok so now I got my midi ports recognized and I could send notes from the browser to ableton using the internal midi bus…. Then I discovered this example which generates random sequences and outputs them over midi, exactly like I was hoping to do… I tried it out with my hardware synthesizer and it gets some nice results.
Magenta JS uses Tone JS for it’s basic ‘player’ functions that allow it to iterate over a note sequence. That player can be given a callback object, with run and stop methods… but I struggled to implement it properly. Here’s the code describing how the magenta player is implemented. Unfortunately for me, the callback wouldn’t work.
In addition, I tried passing the note sequence from the VAE to the RNN and that didn’t work. Neither did converting that note sequence to a midi file.
Anyways, after all this frustration, I gave up. Here’s what I got.
Got a response from some people at google. The documentation did not have the most recent version of magenta js referenced on their cdn. So now with <script src=”https://cdn.jsdelivr.net/npm/@email@example.com″> </script> the callbacks and basic midi conversion now works. Still would have to do more to handle the actual midi output.