magenta / magenta-js

Magenta.js: Music and Art Generation with Machine Learning in the browser
https://magenta.tensorflow.org
Apache License 2.0
2k stars 314 forks source link

Cannot initialize MidiMe (version >= 1.21) #579

Closed HenriAugusto closed 3 years ago

HenriAugusto commented 3 years ago

Hello!

I'm getting a error when initializing MidiMe with version >= 1.21

Reproducing the error is as simple as:

let midime = new mm.MidiMe();
midime.initialize();

The error:

magentamusic.min.js:12900 Uncaught TypeError: Class constructor Ne cannot be invoked without 'new'
    at new e (magentamusic.min.js:12900)
    at t.getEncoder (magentamusic.min.js:12900)
    at t.initialize (magentamusic.min.js:12900)
    at index.html:18

Throwing line seems to be midi_me.ts#275

MCVE:

<!DOCTYPE html>

<head>
    <title>Magenta issue 579</title>
    <meta charset="UTF-8">
</head>

<body>
    <!-- Does NOT work -->
    <script src="https://cdn.jsdelivr.net/npm/@magenta/music@1.21.0/dist/magentamusic.min.js"></script>
    <!-- Works -->
    <!-- <script src="https://cdn.jsdelivr.net/npm/@magenta/music@1.20.0/dist/magentamusic.min.js"></script> -->

    <h1>This is a MCVE for magenta.js issue <a href='https://github.com/magenta/magenta-js/issues/579'>#579</a></h1>

    <script>
        let midime = new mm.MidiMe();
        midime.initialize();
    </script>
</body>
</html>
HenriAugusto commented 3 years ago

I'm closing this in favor of #540.

Although the Issue's title mentions MidiMe.train(), the author talks about .initialize() in the issue's body.