- Notifications
You must be signed in to change notification settings - Fork0
jazz-soft/JZZ-midi-WS
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
and, YES, it's visible from the Web MIDI API!
<scriptsrc="JZZ.js"></script><scriptsrc="JZZ.midi.WS.js"></script>//...
<scriptsrc="https://cdn.jsdelivr.net/npm/jzz"></script><scriptsrc="https://cdn.jsdelivr.net/npm/jzz-midi-ws"></script>//...
<scriptsrc="https://unpkg.com/jzz"></script><scriptsrc="https://unpkg.com/jzz-midi-ws"></script>//...
varJZZ=require('jzz');require('jzz-midi-ws')(JZZ);//...
JZZ.WS.connect('ws://localhost:8888');// not necessarily local :)// ...varport=JZZ().openMidiOut('ws://localhost:8888 - Microsoft GS Wavetable Synth');// ...port.noteOn(0,'C5',127);
See another example athttps://github.com/jazz-soft/JZZ-midi-WS/blob/main/test.html ...
constws=require('ws');constJZZ=require('jzz');require('jzz-midi-ws')(JZZ);// start a WebSocket server (see more ways of doing that at https://github.com/websockets/ws)constwss=newws.Server({port:8888});// start a MIDI via WebSockets serverconstserver=newJZZ.WS.Server(wss);// add actual MIDI portsJZZ().and(function(){varinfo=JZZ().info();for(varpofinfo.inputs)server.addMidiIn(p.id,JZZ().openMidiIn(p.id));for(varpofinfo.outputs)server.addMidiOut(p.id,JZZ().openMidiOut(p.id));});// and/or virtual portsserver.addMidiIn('Dummy',JZZ.Widget());server.addMidiOut('Debug',JZZ.Widget({_receive:function(msg){console.log(msg.toString());}}));
A more advanced example is available athttps://github.com/jazz-soft/WS-MIDI-Server ...