The VBAN TEXT/SERVICE Subprotocols
If you're familiar with Voicemeeter then you've probably heard of VBAN. It's a protocol proposed by VB-Audio for transmitting data (audio/video/text) over a network. With it you can do all kinds of fantastic things.
In order to fully utilise remote controlling over VBAN you need two way communication which requires implementing both TEXT (outgoing) and SERVICE (incoming) subprotocols.
TEXT
Text is fairly straightforward in that you are required to build a packet comprised of a header matching the specification along with a payload and the VBAN server should process it.
A barebones example:
import socket
import struct
import sys
BPS_OPTS: list[int] = [
0, 110, 150, 300, 600, 1200, 2400, 4800, 9600, 14400, 19200, 31250,
38400, 57600, 115200, 128000, 230400, 250000, 256000, 460800, 921600,
1000000, 1500000, 2000000, 3000000
]
SUBPROTOCOL_TXT = 0x40
CHANNEL = 0
STREAMTYPE_UTF8 = 0x10
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
header = struct.pack(
'<4sBBBB16sI',
b'VBAN',
BPS_OPTS.index(256000) | SUBPROTOCOL_TXT,
0,
CHANNEL,
STREAMTYPE_UTF8,
b'Command1'.ljust(16, b'\0'),
0,
)
sock.sendto(header + sys.argv[1].encode('utf-8'), ('localhost', 6980))
Other fantastic projects implementing various VBAN subprotocols:
- vban A pure C implementation of AUDIO/TEXT.
- pyVBAN A python implementation of AUDIO/SERIAL and TEXT.
- obs-vban An OBS plugin implementing AUDIO.
- vbantxt A Go implementation of TEXT offering a single binary
Subscribe to this blog's RSS feed