New JavaScript library

Asynchronous MIDI library for Node.js and HTML

New JavaScript library

Postby sema » Sun Jul 12, 2015 5:39 pm

Since synchronous MIDI calls will no longer be available after Chrome phases out NPAPI plugins,
I've started a new asynchronous wrapper for Jazz-Plugin and possible future solutions, and use Chrome Web MIDI API as a fallback.

Please have a look!
Github: https://github.com/jazz-soft/JZZ
npm: https://www.npmjs.com/package/jzz

MIDI-In and other features are on the way...

Chrome is currently not in it's best shape. It cannot see even built-in Microsoft Wavetable Synth.
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Mon Jul 13, 2015 6:04 am

Brilliant! It works even in Chrome's Canary.
Thank You!
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby letoribo » Mon Jul 13, 2015 6:30 am

Code: Select all
<script><!--
function test(){
  JZZ().or('Cannot start MIDI engine!')
       .openMidiOut().or('Cannot open MIDI Out port!')
       .wait(0).send([0xC0,43,0])
       .wait(500).send([0x90,60,127])
       .wait(0).send([0xC0,46,0])
       .wait(500).send([0x90,64,127])
       .wait(0).send([0xC0,99,0])
       .wait(500).send([0x90,67,127])
       .wait(0).send([0xC0,48,0])
       .wait(500).send([0x90,72,127])
       .wait(1000).send([0x90,60,0]).send([0x90,64,0]).send([0x90,67,0]).send([0x90,72,0])
       .and('thank you!');
}
--></script>

Wow!
Program Change message is also supported!
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby jt419oh » Wed Jul 15, 2015 10:54 am

Thank you for your continued work and development on this pluging Sema.
jt419oh
 
Posts: 51
Joined: Sat Mar 16, 2013 8:49 am

Re: New JavaScript library

Postby sema » Wed Jul 15, 2015 12:46 pm

You are welcome! :)

I've just started the development, a lot of work ahead...
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby sema » Sun Jul 26, 2015 5:25 pm

I have MIDI-In support enabled.
Please check out the latest release!
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Mon Jul 27, 2015 9:19 pm

excellent!
do You plan to implement JZZ.Time() ?
some of my apps depends on it
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby sema » Tue Jul 28, 2015 7:15 am

Sure. Will add to the next release.
by the way, will the current system time be ok, or you have some special way to use it?
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby sema » Tue Jul 28, 2015 5:46 pm

For your request, i've just added the function JZZ().time() - it returns the time in ms since JZZ was initialized.
It first tries performance.now(), then JazzPlugin.Time(), then Date.now().
Still need to update the documentation...
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Tue Jul 28, 2015 11:09 pm

sema wrote:Sure. Will add to the next release.
by the way, will the current system time be ok, or you have some special way to use it?


that is how:
https://github.com/letoribo/jazz.io/blob/master/static/index.html#L264
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby jt419oh » Fri Aug 14, 2015 7:20 am

Is this supposed to work out of the box with latest version of Chrome? The HelloMidi Demo gives an alert with "Cannot start JZZ!".

I do not have the plugin installed and at first it say it is trying to use a plugin that is not supported.

Windows 8.1
Chrome Version 44.0.2403.155 m
jt419oh
 
Posts: 51
Joined: Sat Mar 16, 2013 8:49 am

Re: New JavaScript library

Postby sema » Fri Aug 14, 2015 10:11 am

For some reason, current version of Chrome does not see the default Microsoft MIDI Out.
I have the solution for the problem, but it will take me some time to implement.
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Sat Oct 17, 2015 11:15 am

does Jzz.js works in IE?
thx
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby sema » Sat Oct 17, 2015 4:56 pm

It works in any browser that supports Jazz-Plugin or Web-MIDI API.
Have you experienced any problems?
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby sema » Sat Oct 17, 2015 4:59 pm

And by the way, we have a new solution for Chrome: https://chrome.google.com/webstore/deta ... mjcbpfmbkm
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Sun Oct 18, 2015 3:57 am

yes, when trying to play an example http://jazz-soft.net/demo/SimplePiano.html
i see the pop-up with "cannot open MIDI-port!" message.
please, help.
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby sema » Sun Oct 18, 2015 6:22 pm

Hmm... Indeed, IE11 handles things slightly different from the earlier versions...
I have checked in the fix. Thank you for the timely notification!
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Sun Nov 15, 2015 8:41 am

thanks for the fix.
i've encountered with another issue:
Code: Select all
JZZ().openMidiOut().send([0xc0, 36, 0]).send([0x90,60,127])

works fine in Firefox, but in Chrome throws
Uncaught (in promise) TypeError: Failed to execute 'send' on 'MIDIOutput': Running status is not allowed at index 2 (0).(…)impl._send @ JZZ.js:607_send @ JZZ.js:264_R._exec @ JZZ.js:26_R._resume @ JZZ.js:33_openMidiOut @ JZZ.js:209_R._exec @ JZZ.js:26_R._resume @ JZZ.js:33onGood @ JZZ.js:352
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Re: New JavaScript library

Postby sema » Sun Nov 15, 2015 11:09 am

Will try to find out what is going on. Was it in Windows with the external instrument connected?
Meanwhile, you can try to insert a short wait() between the send()s, or use the Chrome extension: https://chrome.google.com/webstore/deta ... mjcbpfmbkm
sema
Site Admin
 
Posts: 326
Joined: Mon Oct 17, 2011 7:28 pm

Re: New JavaScript library

Postby letoribo » Sun Nov 15, 2015 12:41 pm

yes, in Windows7.
when opening a file:
Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="JZZ.js"></script>
</head>
<body>
<script>
JZZ().openMidiOut().send([0xc0, 36, 0]).wait(100).send([0x90,60,127]);       
</script>
</body>
</html>
letoribo
 
Posts: 98
Joined: Fri Sep 13, 2013 8:25 am
Location: Odessa,Ukraine

Next

Return to JZZ.js

Who is online

Users browsing this forum: No registered users and 1 guest