Can't get playNote duration to work in v2

Hello,

Just started using the library, really cool!

I've been able to successfully use playNote like this:

outputMicrofreak.playNote(60);

but not like this:

outputMicrofreak.playNote(60, {duration: 2000});

If I add duration, I don't get an error, but there is no sound played. I have the same issue with trying to use stopNote( ). If I leave off any options it works, adding options gives no sound.

I read notes about WebMidi time, and have tried to console.log the time but get undefined.

I'm using this version of the library: https://cdn.jsdelivr.net/npm/webmidi

Running via Chrome 92.0.4515.107

And targeting an Arturia Microfreak.

Thanks for any help!!

Brent

Comments

  • The second parameter for the playNote() method is the channel. If you pass an object as the second parameter, it will not know where to send the message. Try this:

    outputMicrofreak.playNote(60, 1, {duration: 2000});
    

    This will send play the note on channel 1. 😃

  • Great, thank you! I added the channel and it works now.

    Really excited to get programming with this!