A low-latency shared piano for two musicians to jam online.
Try Fourhands here.
Explore the source here.
Fourhands uses WebRTC to establish p2p connetions for minimal latency 2-person jamming using MIDI keyboards.
For seamless collaboration on Fourhands, one-way time of 20 ms or less is ideal. Typically this can be acheived on wired connections for fairly nearby players (within 35 miles / 50 km. Anecdotally, a friend has also acheived this between SF and LA – 350 miles / 500 km).
Online jamming has been acheived already, but often not in an accessible and unstructured way.
Comparatively, Fourhands is a simple in-browser solution for which all you need is a MIDI keyboard and an optionally wired internet. Because only MIDI data is shared, it is limited to instruments which can output MIDI.
For self hosting, deploy with
node index.js debug. This will serve the files
needed for the page (index.html and js/) and also start the NodeJs server
If you have local SSL keys you can deploy with HTTPS using
Note that a secure connection is required for MIDI input (localhost is secure
Client should be available at localhost:30001.
Chrome and Edge work. Firefox does not work as there is no support for MIDI. Other browsers are not tested, but should work if they support MIDI, Tone.js, web sockets, and WebRTC.