liushengqiang před 2 roky
rodič
revize
fcc6042aee
1 změnil soubory, kde provedl 7 přidání a 7 odebrání
  1. 7 7
      public/midi/index.html

+ 7 - 7
public/midi/index.html

@@ -42,14 +42,12 @@
         var MIDI = window.MIDI
         MIDI.loadPlugin({
             soundfontUrl: "./soundfont/",
-            instrument: ["acoustic_grand_piano", "synth_drum"],
-            // onprogress: function (state, progress) {
-            //     console.log(1, state, progress);
-            // },
+            // instrument: ["acoustic_grand_piano", "synth_drum"],
             onsuccess: function () {
                 console.log(MIDI)
                 window.handleRendered && window.handleRendered()
-                MIDI.setInstrument(0, MIDI.GM.byName['synth_drum'].number)
+                // MIDI.setInstrument(0, MIDI.GM.byName['synth_drum'].number)
+                // MIDI.setInstrument(1, MIDI.GM.byName['acoustic_grand_piano'].number)
             }
         });
 
@@ -72,8 +70,10 @@
         // var stopBtn = document.getElementById('stopBtn')
         // var skipBtn = document.getElementById('skipBtn')
         playBtn.addEventListener('click', () => {
-            MIDI.noteOn(0, 50, 100, 0);
-            MIDI.noteOff(0, 50, 4);
+            MIDI.noteOn(0, 50, 50, 0);
+            MIDI.noteOff(0, 50, 1);
+            MIDI.noteOn(0, 50, 100, 1);
+            MIDI.noteOff(0, 50, 2);
             console.log(MIDI)
         })
         // pauseBtn.onclick = function () {