Skip to content

MIDI tunneling through BGP, for times when you want to broadcast your music instead of your IP packets.

License

Notifications You must be signed in to change notification settings

Jamesits/bgpiano

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BGPiano

MIDI tunneling through BGP, for times when you want to broadcast your music instead of your IP packets.

Usage

bgpiano-send and bgpiano-recv

Point to Point (Decentralized)

The GoBGP library we use does not support customizing peer TCP port. Thus, you are stuck with port 179 and would (in most cases) need root privilege to listen on that port.

Instrument (MIDI sender) side:

sudo bgpiano-send --bgp-port=179 --bgp-peer-ip=<peer-ip>

Synthesizer (MIDI receiver) side:

sudo bgpiano-recv --bgp-port=179 --bgp-peer-ip=<peer-ip>

Reflected (Centralized)

Reflector side: gobgp or equivalent software required. Any RFC-compliant BGP daemon configured as an RR or RS can be used.

sudo gobgpd --log-plain --config-file=contrib/rr-gobgp/gobgpd.toml

Instrument (MIDI sender) side:

bgpiano-send --bgp-peer-ip=<reflector-ip>

Synthesizer (MIDI receiver) side:

bgpiano-recv --bgp-peer-ip=<reflector-ip>

Utilities

There are some utility programs for debugging your BGP and MIDI sessions. These can run independently and helped a lot during the development process.

  • bgpcat: Connects to a BGP daemon and prints a stream of received routes.
  • midils: Lists all the MIDI input and output ports (devices) on your computer.
  • miditail: Connects to a MIDI input port and prints a stream of received messaged, both in HEX and decoded form.
  • midipipe: Receives MIDI messages from multiple input ports and sends them to multiple output ports.

Building

Go 1.18 or higher is required.

Linux

Requirements:

  • $GOPATH environment variable is set
  • $GOBIN is in $PATH
  • GCC is installed (for CGO)
  • Dependencies: libasound2-dev
go install github.com/goreleaser/goreleaser@latest
goreleaser build --single-target --snapshot --rm-dist -f contrib/goreleaser/goreleaser.linux.yaml

Notes:

  • Check PIE: checksec --dir=dist (should be all green)

Windows

GoBGP does not support Windows officially. But don't worry! We understand music production is hard under Linux and you might have connected all your instruments to your Windows computer. This project equally supports Windows. (Actually, most of the development work is done under Windows.)

The only thing you need is a little hack on the GoBGP library:

cd ..
git clone https://github.com/osrg/gobgp.git
cd gobgp
git apply ..\bgpiano\contrib\windows\gobgp-windows.patch
cd ..\bgpiano
cp contrib\windows\_go.work go.work

go install github.com/goreleaser/goreleaser@latest
goreleaser build --snapshot --rm-dist --single-target -f .\contrib\goreleaser\goreleaser.windows.yaml

FAQ

Why?

There is a trend that Chinese BGP players1 misuse 广播 (lit. broadcasting) in the meaning of 宣告 (lit. announcement). As a terminology fundamentalist and one of the earliest BGP players, I hate this incorrect usage of word to the bone. However, this wrong terminology is now widespread, so I decided to fix it the other way around, by literally broadcasting a piece of music across the Internet, through the BGP RIB.

How?

The MIDI message is encoded in either extended community or large community. See protocol.md for details.

Will this add additional pressure to the routers?

Yes, but unless you programmatically play something violent like 最終鬼畜妹フランドール・S, a modern router should handle it pretty easily.

What's the latency?

For BGP propagation latency across the globe, The speed of BGP network propagation by Ben Cox already provided an excellent overview.

On the topic of latency deviation, due to how BGP routes are received and updated, there are no guarantee that any individual note will arrive on time. Why not have some Jazz instead?

Footnotes

  1. slang for public ASN owners who use the ASN only for education, research and zhuangbility.

About

MIDI tunneling through BGP, for times when you want to broadcast your music instead of your IP packets.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages