djipco / webmidi

Tame the Web MIDI API. Send and receive MIDI messages with ease. Control instruments with user-friendly functions (playNote, sendPitchBend, etc.). React to MIDI input with simple event listeners (noteon, pitchbend, controlchange, etc.).
Apache License 2.0
1.54k stars 115 forks source link

output.playNote("C3") doesn't make any ksound #7

Closed soichih closed 7 years ago

soichih commented 7 years ago

I am trying to see if this works on Chrome, and I did following

    WebMidi.enable(function (err) {
      if (err) {
        console.log("WebMidi could not be enabled.", err);
      } else {
        console.log("WebMidi enabled!");
        var mout = WebMidi.outputs[0];
        var mout.playNote("C3");
      }
    });

It doesn't make any sound. Do I need to set volume, instrument, etc?

soichih commented 7 years ago

Sorry, I think I should be using soundfont-player instead.. (https://www.npmjs.com/package/soundfont-player)

djipco commented 7 years ago

The playNote() method sends note on commands to the output it is called upon. The output must be a software or hardware MIDI device recognized by your system. It is that device that will play the sound, not WebMidi.js. But, considering your second message, I guess you figured that out! :-)