liushengqiang 2 년 전
부모
커밋
fcc6042aee
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  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 () {