JackTrip Documentation
repository·main·Indexed 21 days ago
https://github.com/jacktrip/jacktripA multi-machine audio system for high-quality, uncompressed, bidirectional audio streaming over the Internet for network music performance. Supports cross-platform environments (Linux, macOS, Windows, FreeBSD) and includes documentation for hub server containerization via Podman and Docker, AUv2/AUv3 Audio Bridge plugins for DAWs, and integrated libraries such as oscpp for OSC packet handling and Simple-FFT for Fast Fourier Transforms.
What's inside JackTrip
- JackTrip is a multi-machine audio system designed for network music performance over the Internet. It enables bidirectional, high-quality, uncompressed audio signal streaming for any number of channels, limited only by the computer and network capabilities. The system is cross-platform and supports heterogeneous environments, meaning machines running different operating systems (e.g., Linux, macOS, Windows, or FreeBSD) can connect to each other.
What is JackTrip?
mainJackTrip is a multi-machine audio system designed for network music performance over the Internet. It is cross-platform, supporting Linux, macOS, and Windows.
Key capabilities include:
- Bidirectional, high-quality, uncompressed audio signal streaming.
- Support for an arbitrary number of channels (limited only by hardware and network capacity).
- Cross-platform interoperability (e.g., a Linux machine can connect to a macOS machine).
What is JackTrip Virtual Studio?
mainJackTrip Virtual Studio is an enhanced environment for online musical collaboration. It provides:
- Live Broadcasting Support: Integration with JackTrip Radio for sharing sessions.
- Soundscapes DSP: Real-time digital signal processing (DSP) allowing musicians to use audio effects such as reverb, compression, and attack to enhance performances.
Compare JackTrip Hub Server connection types
mainThe JackTrip Hub Server supports three connection types, each suited for different deployment scenarios:
- UDP: Traditional low-latency transport. Requires open firewall ports and port forwarding for NAT traversal. Uses TCP for signaling and UDP for audio.
- WebRTC: Browser-compatible connection using WebRTC data channels. Provides excellent NAT traversal via ICE/STUN/TURN. Uses WebSocket over TCP for signaling.
- WebTransport: Modern HTTP/3 transport using QUIC. Provides built-in NAT traversal and low latency (0-RTT). Uses a single UDP port (4464) for both signaling and audio.
All types share the same audio packet format and worker pool allocation mechanism.
| Feature | UDP | WebRTC | WebTransport | |---------|-----|--------|--------------| | **Transport** | UDP datagrams | WebRTC data channels over UDP | QUIC datagrams over UDP | | **Signaling** | TCP port 4464 | WebSocket over TCP 4464 | HTTP/3 over UDP 4464 | | **NAT Traversal** | No | Yes (ICE/STUN/TURN) | Yes (QUIC connection migration) | | **Browser Support** | No | Yes (all modern browsers) | Yes (Chrome 97+, Edge 97+) | | **Encryption** | Optional (TLS) | Mandatory (DTLS) | Mandatory (TLS 1.3) | | **Setup Complexity** | Simple | Complex (ICE negotiation) | Medium (HTTP/3 CONNECT) | | **Connection Time** | Fastest | Medium (ICE gathering) | Fast (0-RTT after first) | | **Audio Transport Port** | UDP (61002 + worker_id) | ICE-negotiated UDP ports | UDP 4464 (QUIC) | | **Library Required** | None (Qt Network) | libdatachannel | msquic | | **Build Option** | Always available | `-Dlibdatachannel=enabled` | `-Dmsquic=enabled` |Implement UDP redundancy for packet loss mitigation
mainWhen redundancy is enabled with a factor $R$, each UDP datagram contains $R$ full packets concatenated. The newest packet is placed first, followed by older packets in descending order of age.
Sender logic: Prepend the newest full packet to a buffer of previous packets each period. Receiver logic:
- Read the first packet's
SeqNumber. - If it is not the expected sequence, scan the concatenated packets for the missing one.
- Deliver multiple packets from the datagram in order if they are found.
- Read the first packet's
Protocol detection on the hub TCP port
mainThe hub server multiplexes three connection types on a single TCP listen port by inspecting the first three bytes of each new connection.
Initial Detection (First 3 bytes)
First 3 bytes (hex) Interpretation 16 03 01through16 03 04TLS ClientHello (browser wss://) — start TLS handshake; re-detect after decryptAnything else Legacy binary hub protocol — read 32-bit LE port number Post-TLS Handshake Detection (Decrypted content)
Once the TLS handshake is complete, the server inspects the decrypted bytes:
Decrypted content Interpretation GET /ping …Health-check endpoint — responds {"status":"OK"}and closesGET /webrtc …HTTP WebSocket upgrade → WebRTC signaling path Other GET …Unsupported path — responds HTTP 404 and closes Other binary data Authenticated binary hub protocol (credentials follow) Understand WebRTC signaling flow
mainWebRTC signaling occurs over a WebSocket connection following these steps:
- TLS Handshake: Client connects via
wss://. The server detects the TLS ClientHello via the 3-byte record header. - WebSocket Upgrade: Client sends an HTTP
GET /webrtcrequest withUpgrade: websocketheaders. - Protocol Detection: Client sends a
PROTOCOL_DETECTJSON message:{"type": "protocol_detect", "protocol": 2, "clientName": "...", "version": 1}. - SDP Exchange: Client sends an
OFFER(SDP); Server responds with anANSWER(SDP). - ICE Gathering: Both sides exchange
ICE_CANDIDATEmessages. - Data Channel: Once ICE + DTLS handshake completes, the data channel (labeled
"audio") opens for bidirectional audio datagrams.
Signaling Message Format: All signaling messages are JSON objects prefixed with a 4-byte big-endian length prefix over the TCP socket:
[4-byte length (BE)] [JSON payload].- TLS Handshake: Client connects via
Understand JackTrip's network transport modes
mainJackTrip uses different transport mechanisms depending on the deployment mode:
- UDP (audio): The primary real-time transport. It carries
PacketHeader+ raw audio payload. When redundancy is enabled, multiple packets are concatenated into a single datagram for FEC. - UDP (control): A specific 63-byte datagram consisting entirely of
0xFFused to signal a shutdown ("Peer Stopped"). - TCP (hub/ping-server handshake): A short-lived connection used to exchange ephemeral UDP port information. This may include TLS and credential authentication.
- WebRTC data channel (audio): Used by the hub server's WebRTC path. It carries the same packet format (header + planar audio payload) as UDP. Signaling requires an encrypted WebSocket (
wss://). - WebTransport / QUIC datagrams (audio): Used by the hub server's WebTransport path via HTTP/3 over QUIC (unreliable datagrams). The session is established via an HTTP/3 CONNECT request.
- UDP (audio): The primary real-time transport. It carries
How oscpp works: Client vs Server
mainThe library is organized into two primary namespaces representing the two sides of OSC communication:
OSCPP::Client: Used for constructing and building OSC packets. It provides a fluent API to open bundles/messages and write arguments into a provided memory buffer.OSCPP::Server: Used for parsing and reading OSC packets. It provides abstractions likePacket,Bundle,Message, andArgStreamto traverse the structure of received data.
Performance Note: The library is designed for real-time sensitive contexts (like audio driver callbacks) because it avoids memory allocation (except when throwing exceptions) and system calls.
How the JackTrip AUv3 architecture works
mainThe AUv3 plugin uses a hybrid C++/Objective-C architecture to balance high-performance audio processing with macOS framework integration:
JackTripAU: The mainAUAudioUnitsubclass acting as the Objective-C wrapper for the AUv3 framework.JackTripAUImpl: The C++ implementation class that contains all core audio processing logic.AudioBridgeProcessor: The shared C++ audio processing engine (consistent with AUv2 and VST3 versions) that handles the actual audio exchange.JackTripAUViewController: A native Cocoa-based UI controller for the plugin interface.JackTripAUFactory: Handles the registration of the Audio Unit component.
Format the UDP audio payload (Planar/Non-interleaved)
mainOn the wire, the audio payload is planar (non-interleaved) by channel. This means all samples for a single channel are grouped together before moving to the next channel:
- First $N$ samples for channel 0
- Then $N$ samples for channel 1
- ...and so on.
Where $N$ is the
BufferSize. Note that for mono ($C=1$), the planar and interleaved layouts are identical.Use the JackTrip VST3 Audio Bridge Plugin
mainThe JackTrip VST3 plugin acts as a bridge between your Digital Audio Workstation (DAW) and a running JackTrip instance on the same machine.
Setup Steps
- Launch JackTrip: Start the JackTrip application in your desired mode on your local machine.
- Insert Plugin: Load the "JackTrip Audio Bridge" VST3 plugin into a track in your DAW.
- Connection: The plugin automatically attempts to connect to the JackTrip application via a local socket.
Plugin Parameters
- Send Gain: Controls the level of audio sent to remote participants (Range: -60 to +6 dB).
- Output Mix: Blends received audio (0%) with input passthrough (100%).
- Output Gain: Master output level (Range: -60 to +6 dB).
- Bypass: Bypasses all audio processing.
- Connected: A read-only indicator showing the current connection status.