Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

MIDI via WebSockets

NotificationsYou must be signed in to change notification settings

jazz-soft/JZZ-midi-WS

Repository files navigation

MIDI via WebSockets for browser and Node.js

and, YES, it's visible from the Web MIDI API!

npmnpmbuildCoverage Status

Usage

Plain HTML
<scriptsrc="JZZ.js"></script><scriptsrc="JZZ.midi.WS.js"></script>//...
CDN (jsdelivr)
<scriptsrc="https://cdn.jsdelivr.net/npm/jzz"></script><scriptsrc="https://cdn.jsdelivr.net/npm/jzz-midi-ws"></script>//...
CDN (unpkg)
<scriptsrc="https://unpkg.com/jzz"></script><scriptsrc="https://unpkg.com/jzz-midi-ws"></script>//...
CommonJS
varJZZ=require('jzz');require('jzz-midi-ws')(JZZ);//...

Client

(Browser or Node.js)
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 ...

Server

(Node.js only)
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 ...

About

MIDI via WebSockets

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp