weirdnet-streaming
Streaming for Weirdnet: live and recorded audio streams between nodes, the transport that keeps several players together, and the loop-positioned streams that apps record along with. It is the one crate for all of it, and the successor to weirdnet-audio-stream.
Part of Weirdnet by Weird Brains. BSD-3-Clause.
What it does
Streams
- Publish and subscribe: a
Publishersends frames of one stream to any number of listeners, in process or over the network.sendnever blocks; each listener has its own bounded queue with an overflow policy (drop oldest, skip to the next key frame, or disconnect), so a slow listener never slows the others. - Live and recorded: a late live listener starts at the next key frame; a recorded stream (
Recordinginto aMemorySource) plays from the start or from a position. - Codec-agnostic: frames carry bytes, a timestamp in ticks of the stream's clock and a key flag; raw PCM works with no codec (
StreamInfo::pcm_f32,Frame::pcm_f32). - Over Weirdnet:
net::serveoffers aHubof streams on a weirdnet-net node, asking aStreamAuthabout each subscription;net::Subscriberconnects to one and keepsStats(frames, loss, arrival delay, jitter). - Clocks:
clock::serve_clockandclock::measurefind another node's clock offset;clock::DriftFitfits it over time for the drift in ppm. - Remote routing (feature
route):remote::RemoteExecutoris a weirdnet-audio-route executor for the connections between a weirdnet-audio-engine router and other nodes, with resampling, drift following and aligned links;remote::PeerTabletells it where nodes are.
Transport
transport: a master starts, stops, locates and sets the tempo of several instances. Messages (Transport) are plain serde values; aFollowerlearns the master's session clock from them and tells its engine (Action) what to do on the right audio block, and corrects drift without jumping over a hit.
Loop-positioned streams (record-along)
stage: stream and frame metadata saying where on the sender's loop each frame belongs, andGridto place it on yours at any sample rate.align: where a collaborator's audio plays on your loop (a take in place, live in whole bars, or immediate).bus: the audio-thread side, a tap and a mix over lock-free rings.listenandalong: the network side, listen-along (a master out as a stream) and record-along (your dry stream and take, and a collaborator's played aligned to your loop).clocked: a manual sink on its own clock, to run without a device or to inject drift in tests.
The wire format is a length-prefixed message per frame on one weirdnet-net stream (see the wire module).
Coming from weirdnet-audio-stream
weirdnet-audio-stream 0.4 re-exports this crate and is deprecated. Replace the dependency with weirdnet-streaming and weirdnet_audio_stream with weirdnet_streaming; the 0.3 API is unchanged.