Examples
What each example in the streamlib repository shows, what it needs, and how its stream is wired. Every one ships with the runtime as a sample project.
The streamlib repository has twelve examples, each a small project that does one thing well: a GPU halftone, an object detector, a reverb, a lower third. Each is an ordinary project, a tatolab-project.json, a pyproject.toml and a graph document in streams/, and each ships with the runtime as a sample.
In Tato Studio, choose File › Marketplace…, find the sample, and press Clone sample: it becomes a project of your own, ready to play and change. Every example’s pictures are meant to be watched in Studio’s Node visualizer; none opens a window of its own.
From a terminal, start a project from one with tatolab new, then open its folder in Studio:
tatolab new my-halftone --sample camera-halftonecd my-halftonetatolab devCamera
Section titled “Camera”camera-display
Section titled “camera-display”Source. The camera, seen in the Node visualizer: the smallest useful stream, one CameraSource node and nothing else. It shows what a project is: a folder, its Python dependencies, and a graph document.
Needs: a camera.
camera-compute-kernel and camera-halftone
Section titled “camera-compute-kernel and camera-halftone”Source · Source. The camera through a Slang compute kernel, in a process node: black and white in one, newsprint dots in the other. Each builds its kernel once in setup and dispatches it per frame, and the pixels never leave the GPU.
CameraSource → GrayscaleCompute (or HalftoneCompute)Needs: a camera.
camera-python-effects
Section titled “camera-python-effects”Source. A broadcast look built from six Python nodes: Slang glitch and film-grain kernels, MediaPipe pose tracking driving a ModernGL avatar, and a Skia overlay, composited on the GPU.
Needs: a camera. MediaPipe, ModernGL and Skia come from the project’s dependencies.
camera-virtual-camera
Section titled “camera-virtual-camera”Source. One capture device in, two cameras out: “Tatolab Camera”, the camera untouched, and “Tatolab Camera Inverted”, after a Python node inverts its colours. Every app on the machine can pick either while the project plays.
CameraSource ─┬─▶ VirtualCameraSink ("Tatolab Camera") └─▶ InvertingEffect ─▶ VirtualCameraSink ("Tatolab Camera Inverted")Needs: Linux, a camera, and v4l2loopback or PipeWire. See Virtual camera.
lower-third
Section titled “lower-third”Source. A live lower third and a Rive station bug over the camera, at 1080p60. A web page drawn by BrowserSource and a Rive animation drawn by RiveSource are layered over the camera by AlphaOverCompositor, and a data message swaps the lower third’s template without restarting anything.
CameraSource ─────────────────────────────────────▶ layer_0 ─┐LowerThirdRundown ─ data ─▶ BrowserSource ────────▶ layer_1 ─┼─ AlphaOverCompositorRiveSource ───────────────────────────────────────▶ layer_2 ─┘Needs: a camera.
Publishing
Section titled “Publishing”camera-webrtc-publish
Section titled “camera-webrtc-publish”Source. The camera and microphone, encoded with H.264 and Opus, sent as one WHIP session with two tracks. Its publisher subclasses WhipPublisher to read the endpoint from the runtime’s environment, so the URL’s key is never in the graph document.
CameraSource ─▶ H264Encoder ─┐ ├─▶ WhipPublisherToTheRuntimeEnvironmentsEndpointMicrophoneSource ─▶ OpusEncoder ─┘Needs: a camera, a microphone, hardware H.264 encode, and a WHIP endpoint, such as Cloudflare Stream’s, in STREAMLIB_WHIP_URL. See WebRTC.
Models
Section titled “Models”fisheye-object-detection
Section titled “fisheye-object-detection”Source. The pipeline a small drone flies with, on a desk: the camera through a synthetic fisheye lens, then rectified by a compute kernel and run through an object detector, with the distorted and the corrected views both in the Node visualizer.
CameraSource ─▶ SyntheticFisheyeLens ─▶ UndistortingObjectDetectorNeeds: a camera, and a PyTorch build that sees your GPU. See Use your model.
microphone-reverb-speaker
Section titled “microphone-reverb-speaker”Source. The microphone through a reverb to the speaker: you hear yourself in a room that isn’t there. Its input asks for 10 ms mono windows, and the runtime converts whatever the microphone delivers.
MicrophoneSource ─▶ ReverbEffect ─▶ SpeakerSinkNeeds: a microphone, a speaker, and headphones, or it feeds back.
audio-mixer-demo
Section titled “audio-mixer-demo”Source. Three sine voices at three different sample rates and block sizes, one of them stereo, mixed into a C major chord. The mixer’s window contract does every conversion; there’s no resampler in its code.
ToneSource ×3 ─▶ ChordMixer ─▶ SpeakerSinkNeeds: a speaker.
GPU and patterns
Section titled “GPU and patterns”test-pattern-halftone-lens
Section titled “test-pattern-halftone-lens”Source. The test pattern through a halftone lens kernel, then a CPU meter that logs its brightness once a second: pixels on the GPU, logic on the CPU, the two halves most streams have.
TestPatternSource ─▶ HalftoneLensEffect ─▶ BrightnessMeterNeeds: nothing: no camera and no display.
raytracing-showcase
Section titled “raytracing-showcase”Source. One scene rendered twice and cut down the middle: rasterized on the left, ray traced on the right, with the same camera, geometry and shading, so the difference is what casting a ray buys.
RasterizedSceneRenderer ─┐ ├─▶ SplitScreenCompositorRayTracedSceneRenderer ──┘Needs: a GPU with hardware ray tracing. See GPU effects.