title: Uncaught (in promise) Error: Number of splits must evenly divide the axis
body: <h1>Summary</h1>
  
  <ol>
  <li>Context</li>
  <li>The problem</li>
  <li>What did I try to fix this bug?</li>
  <li>How to reproduce this bug (+ required data)?</li>
  <li>My questions</li>
  <li>Sources</li>
  </ol>
  
  <hr>
  
  <h1>Context</h1>
  
  <p>I would want to generate a new sequence of notes of a MIDI file thanks to MusicRNN chord_pitches_improv.</p>
  
  <h1>The problem</h1>
  
  <p>My call to <code>music_rnn.continueSequence</code> triggers the following error:</p>
  
  <blockquote>
    <p>Uncaught (in promise) Error: Number of splits must evenly divide the axis.
        at C (music:22)
        at split_ (music:22)
        at Module.split (music:22)
        at t.sampleRnn (music:83)
        at music:83
        at music:22
        at t.scopedRun (music:22)
        at t.tidy (music:22)
        at Module.$e (music:22)
        at t. (music:83)</p>
  </blockquote>
  
  <h1>What did I try to fix this bug?</h1>
  
  <p>Nothing because I don't even understand the error.
  Note: I have MuseScore. So If something must be changed in the MIDI file, I can do it.</p>
  
  <h1>How to reproduce this bug (+ required data)?</h1>
  
  <ol>
  <li><p>Download the following MIDI file: <a href="https://a.uguu.se/kP1iJ4JVeTrD_b.mid" rel="nofollow noreferrer">https://a.uguu.se/kP1iJ4JVeTrD_b.mid</a> and rename it "b.mid"</p></li>
  <li><p>Create a directory in which you store the MIDI file</p></li>
  <li><p>In this same directory, create a file titled <code>index.html</code>: copy/paste in this HTML file the code provided below (section "Sources")</p></li>
  <li><p>Open your browser and open this HTML file: my script will automatically be executed, and the error will be triggered.</p></li>
  </ol>
  
  <h1>My questions</h1>
  
  <p>What does this error mean? How could I fix it? Should I change something in the MIDI file (if yes: what? How? Can I use MuseScore to do it?)?</p>
  
  <h1>Sources</h1>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
      &lt;meta charset="UTF-8"&gt;
      &lt;title&gt;Music&lt;/title&gt;
      &lt;script src="https://cdn.jsdelivr.net/npm/@magenta/music"&gt;&lt;/script&gt;
      &lt;script src="https://unpkg.com/@tonejs/midi"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script&gt;
      loadMidi = async function() {
          const sequence = {'notes': []}
          const midi = await Midi.fromUrl("b.mid")
          midi.tracks.forEach(track =&gt; {
            const notes = track.notes
            notes.forEach(note =&gt; {
              if(note.midi &lt; 48) {
                  note.midi = 48
              }
              if(note.midi &gt; 83) {
                  note.midi = 83
              }
  
              sequence['notes'].push(
                  {
                      pitch: note.midi,
                      velocity: note.velocity * 100,
                      startTime: note.time,
                      endTime: note.time + note.duration
                  }
              )
            })
          })
  
           try {
              const quantizedSequence = mm.sequences.quantizeNoteSequence(sequence, 1)
              const improvCheckpoint = 'https://storage.googleapis.com/magentadata/js/checkpoints/music_rnn/chord_pitches_improv'
              const music_rnn = new mm.MusicRNN(improvCheckpoint)
              const prepareMusic = async() =&gt; {
                  await music_rnn.initialize()
                  var improvisedMelody = await music_rnn.continueSequence(quantizedSequence, 60, 1.1, ['Bm', 'Bbm', 'Gb7', 'F7', 'Ab', 'Ab7', 'G7', 'Gb7', 'F7', 'Bb7', 'Eb7', 'AM7'])
                  improvisedMelody.notes.forEach(n =&gt; n.velocity = 100)
                  var midi_bytes_array = mm.sequenceProtoToMidi(improvisedMelody)
                  saveByteArray("generated_music.midi", midi_bytes_array);
              }
  
              prepareMusic()
  
            } catch (error) {
              console.error(error)
          }
  
         }
         loadMidi();
  
       function saveByteArray(reportName, byte) {
              var blob = new Blob([byte], {type: "audio/midi"});
              var link = document.createElement('a');
              link.href = window.URL.createObjectURL(blob);
              var fileName = reportName;
              link.download = fileName;
              link.click();
          };
      &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>