Expand description
Streaming for Weirdnet: audio streams between nodes, the transport that keeps them together, and the loop-positioned streams apps record along with.
Streams (the core, moved here from weirdnet-audio-stream)
- A
PublishersendsFrames of one stream to any number of listeners. It never blocks: each listener has its own bounded queue and anOverflowpolicy, so a slow listener never slows the others. - A late live listener starts at the next key frame; a
MemorySourceholds a recorded stream that listeners can seek in. - Frames are codec-agnostic: the crate moves bytes and a
CodecIdand never decodes. Raw PCM needs no codec (StreamInfo::pcm_f32). Streams and frames carry optional opaque app metadata that the crate never reads. netserves aHubof streams over weirdnet-net streams, with an authoriser per subscription, andnet::Subscriberconnects to one, withStatson arrival delay, jitter and loss.clock: another node’s clock offset by request and reply, and its drift by a line fit.remote(featureroute): a weirdnet-audio-route executor carrying connections between a weirdnet-audio-engine router and other nodes, with resampling, drift following and measured delay, and aremote::PeerTableto tell it where nodes are.
Transport
transport: the follow-transport protocol (Prepare,Ready,Start,Stop,Locate,Tempo,Beacon), thetransport::SessionClockan instance learns from a master’s messages, and thetransport::Followerthat turns them into engine actions on the right audio block. It is a plain message type: the app chooses how to carry it.
Loop-positioned streams (record-along)
stage: stream and frame metadata saying where on the sender’s loop each frame belongs, andstage::Gridto turn that into the listener’s own frames at any sample rate.align: where a collaborator’s audio plays on your loop (recorded exact, live bar-aligned or immediate).bus: the audio-thread side, a tap and a mix that never lock or allocate in the render callback.listenandalong: the network side, listen-along (a master out as a stream) and record-along (a dry stream and take, and playing a collaborator’s aligned to your loop).clocked: a manual sink on its own clock, to run without a device or to inject drift in tests.
Re-exports§
pub use net::AllowAll;pub use net::Hub;pub use net::StreamAuth;
Modules§
- align
- The stream input’s aligner: where each collaborator’s audio plays on your loop.
- along
- Record-along on the network: your dry stream (your own voices, each frame stamped with its loop position), your last loop as a stamped recorded take, and playing a collaborator’s take or live dry stream aligned to your loop.
- bus
- The audio side of listen-along, safe on the audio thread: a wrapper around the engine’s render callback that copies the master out into a ring (the tap, read by the network side to stream it) and adds samples from another ring (the mix, filled by a subscription to someone else’s master out). No locks and no allocation in the callback.
- clock
- How far another node’s clock is from this one’s, and how fast the gap grows.
- clocked
- A manual sink on its own clock: a thread that calls the render callback once per block at
the pace of a device whose clock runs
drift_ppmfast (or slow, when negative) against the monotonic clock. Used for instances whose output isnone, and in tests to inject drift. - listen
- Listen-along: the host streams its master out as raw PCM (32-bit float) over weirdnet-streaming; members of the session subscribe and hear it mixed into their own output. Each frame carries the sender’s wall-clock time (frame metadata, 8 bytes, microseconds since the Unix epoch) so a listener can measure the one-way delay when the clocks agree (same machine, or synced clocks). The take is kept and offered as a recorded stream that can be played from any position.
- net
- Streams over weirdnet-net: a
Hubserved on a node, and aSubscriberto one stream. - remote
- A remote executor (feature
route): the connections of aweirdnet_audio_routegraph between this node’sweirdnet_audio_enginerouter and other nodes. - stage
- Stage stream metadata (record-along): what a stream is, and where on the sender’s loop each frame belongs. The stream crate carries both as opaque bytes.
- transport
- Follow-transport: a headless master starts, stops, moves and paces several instances so they play on one session time.
- wire
- The wire format: length-prefixed messages on one weirdnet-net stream.
Structs§
- Buffer
Policy - How much a listener may queue.
- CodecId
- An opaque codec name, for the decoder; never interpreted here.
- Frame
- One frame of a stream.
- Listener
- The receiving side of one in-process subscription. Dropping it leaves the stream.
- Listener
Info - One listener as the publisher sees it.
- Memory
Source - A recorded stream held in memory.
- Publisher
- The sending side of one stream. Cheap to clone; clones share the stream.
- Recording
- Collects a live stream’s frames into a
MemorySource. - Stats
- What a subscriber has seen: frames, loss, and how late and how unevenly frames arrive.
- Stream
Id - A stream’s id, unique within its publisher’s hub.
- Stream
Info - What a stream is.
- Subscribe
Options - How to subscribe.
Enums§
- Overflow
- What happens when a listener’s queue is full.
- Start
- Where a subscription starts.
- Stream
Error - Why a stream call failed.
- Stream
Event - What a listener receives.
- Stream
Kind - Live (frames as they are produced) or recorded (finite, seekable).
Constants§
- PCM_
F32LE - Raw PCM, 32-bit float, little endian, interleaved.
- PCM_
S16LE - Raw PCM, signed 16-bit, little endian, interleaved.
Traits§
- Frame
Source - A recorded stream a server can play to subscribers.