techlist.io

Webrtc

9 posts

OpenAI2026-08-025 min readCurated summary

How we built a realtime system for responsive voice AI in six months

# How OpenAI Built GPT‑Live: A Realtime Voice System Engineered Around Continuous Audio OpenAI's GPT‑Live replaces the turn-based design of earlier voice assistants with a full-duplex voice model that listens and speaks at the same time, with no separate turn detector in the audio path. Frontier models such as GPT‑5.5 are consulted asynchronously for deeper reasoning and tool use, so the conversation never pauses for them. Delivering this required rethinking inference, context management, delegation, transport, and session startup so that every layer keeps audio flowing on schedule. ## Why Turn-Based Voice Fell Short - Earlier systems used small turn detectors to decide when the user had finished speaking. Guessing too early cut users off, and guessing too late made responses feel sluggish. - Cascaded pipelines ran speech-to-text, the LLM, and text-to-speech in series, adding latency and discarding cues like tone and pacing. - Speech-to-speech models improved fidelity, but they still waited on a turn detector, so the interaction remained turn-based. ## Streaming Inference and Continuous Media - Audio streams into the voice model and speech streams back out, rather than being handled as discrete request-response blobs. - A dedicated fast path carries media, while delegation, tool calls, and persistence run behind an asynchronous RPC boundary. A slow tool can delay its own result but cannot stall audio. - The media frontend and inference logic were rewritten from Python asyncio to Go, bringing the p95 frame delivery time in line with the previous system's p50. - WebRTC handles transport. Under late packets it stretches audio to avoid gaps, then briefly speeds playback to catch up to real time. ## Stateful Handoffs and Context Compaction - Long sessions outgrow context limits, and model instances scale up and down with demand. To handle this, a replacement instance is warmed and prefilled with current session context, runs in parallel with the original, and takes over once ready. - Compaction is treated as another managed transition. Shrinking context invalidates the KV cache, which would normally force a costly re-prefill. Instead, the system prepares a compacted replacement in the background and switches over without interrupting media. ## Delegation Without Blocking the Conversation - The frontier model's session is created and prefilled with initial context when the voice session starts, so the prompt is already processed when the first delegated request arrives. - Session affinity and prompt caching keep latency low, and worker failures remain recoverable. - Reasoning effort, output limits, tool schemas, and model-tool round trips were tuned to shorten the time until a useful result returns. - Because the rest of ChatGPT expects discrete messages, the application server converts continuous speech into turns. It uses partial transcripts and timing signals to infer the speaker, keeps the newest message provisional, and finalizes it once attribution is reliable. - Two views are maintained: a speculative view for the live UI and an authoritative transcript for analytics and safety logging. Brief acknowledgments like "mm hmm" are generally not promoted to their own messages, while substantive interjections often are. ## Faster Session Startup with WARP and Instant Connect - A vanilla WebRTC session needs several handshakes and round trips before media flows. WARP (WebRTC Abridged Roundtrip Protocol) cuts media and data startup from six round trips to one. It does this by piggybacking DTLS on ICE (SPED), using DTLS 1.3, pre-negotiating SCTP (SNAP), and pre-negotiating data channels instead of using DCEP. - These are open specifications, being advanced through the IETF TSVWG working group. WARP support has been added to libwebrtc and Pion. - Instant Connect negotiates SDP parameters ahead of time without reserving server capacity. The server materializes the session on the first media packet if the parameters are valid, and falls back to the standard signaling flow with no added latency if they are stale. - Together, these let a client start a session with a single UDP packet. ## Testing in Production Before Launch - A silent shadow test routed a growing share of real ChatGPT Voice sessions to GPT‑Live, which ran read-only while Advanced Voice Mode continued serving users. This exposed the system to real networks, session lengths, and geographies without changing what users heard. - Capacity could not be measured by GPU throughput alone. CPU-side stream handlers, queues, and network paths saturated earlier than load tests predicted. The capacity question became how many concurrent sessions could keep every frame on schedule. - Geography mattered. Routing sessions to distant capacity added delay at several points, so rollouts were validated alongside regional capacity and traffic-steering configuration. - Long sessions, reconnects, and client disconnects surfaced memory pressure, state-restoration issues, and shutdown races that short load tests missed. - The team added finer-grained telemetry, validated configurations against known-good baselines, ramped traffic in stages, and built the ability to isolate or disable individual paths quickly. ## Conclusion The central lesson is that voice responsiveness depends on every component in the path, not just the model. Streaming inference, a dedicated media path, asynchronous delegation, and optimized transport work together to keep conversation feeling live. The same architecture is expected to underpin the forthcoming GPT‑Live API and broader agentic voice experiences.

Cloudflare2026-07-313 min readCurated summary

An API for MoQ: provision your own isolated relays

Cloudflare has moved MoQ from an open testing network toward production use by adding isolated relays and authentication. Its provisioning API and dashboard let applications create globally available relay scopes and issue separate publisher and subscriber credentials, without deploying infrastructure. The beta supports MoQ Transport drafts 14 and 16 and is currently free. ## MoQ and Its Architecture - MoQ is an open IETF publish/subscribe protocol built on QUIC, the transport used by HTTP/3. - Publishers send named data streams, while subscribers request those streams through relays. - Relays copy data to subscribers without inspecting its contents, enabling efficient fan-out. - The same system can support live video, video calls, low-latency messaging, and other real-time workloads. - Using CDN-based relays avoids the cost and complexity of operating specialized media servers. ## From Open Preview to Production - Cloudflare’s initial MoQ preview exposed an unauthenticated relay on servers in more than 330 cities. - Over 1,000 clients continue to use the open endpoints daily for testing and development. - The lack of authentication made the preview unsuitable for applications requiring confidentiality or role-based permissions. - For example, live auction applications need broadcasters to publish while viewers can only subscribe. ## Isolated Cloudflare Relays - Provisioning a relay creates an isolated scope across Cloudflare’s existing global network rather than starting a VM, container, or dedicated process. - Each scope separates an application’s namespaces, tracks, and objects from those of other applications. - Clients connect through an Anycast endpoint, with Cloudflare handling global routing. - Relays become available within seconds, without regional capacity planning, load balancers, or server management. - Cloudflare compares the model to creating a virtual host rather than deploying a new web server. ## Provisioning API and Access Tokens - The control-plane API manages relay configuration and credentials but does not handle the media flowing through relays. - A relay defines the isolated application scope. - Tokens grant `publish`, `subscribe`, or both operations for a specific relay. - Tokens can have expiration times and can be revoked independently. - Creating a relay automatically returns: - A token capable of publishing and subscribing. - A subscribe-only token intended for viewers. - Additional narrowly scoped tokens can be created through the API or dashboard. - Current tokens apply to an entire relay; Cloudflare is working with the MoQ community on more granular authorization. ## Using the API and Dashboard - A relay can be created with one authenticated API request containing its name. - Tokens can be added through an endpoint such as `/moq/relays/$RELAY_ID/tokens`. - The dashboard workflow is available under **Media > Realtime > MoQ Relay**. - Applications should provide broadcasters with publish-capable credentials and viewers with subscribe-only credentials. ## Connecting Clients - Clients send their token when opening a MoQ session. - The relay enforces the token’s permitted operations. - Cloudflare’s open-source `moq-rs` tools can be used with media generated by tools such as `ffmpeg`. Cloudflare’s authenticated, isolated MoQ relays make the protocol more practical for production real-time applications. Developers can use the API or dashboard to provision a globally distributed relay and manage separate, expiring credentials without operating their own media infrastructure.

LINE2026-07-023 min readCurated summary

Building a Group Video Calling Service Inside a LINE App with AI, Without a Web Engineer

LINE’s LIFF enables web services to run directly inside the LINE app, turning a LINE Official Account into an interactive service platform rather than merely a notification channel. The LINE Planet team demonstrated this by building a group video-calling service with only a PM and an Android engineer, without a web engineer. The core architecture combines a LIFF web app, a small token-issuing app server, and LINE’s managed authentication and WebRTC infrastructure. ## Services Enabled by LINE OA and LIFF - **Professional consultations:** One-to-one video sessions with lawyers, financial planners, counselors, and other experts. - **Remote education:** Scheduled video lessons with separate rooms for multiple teachers and students, including screen sharing. - **Interactive live broadcasts:** Events for 500 to 10,000 simultaneous participants, including audience members joining conversations as panelists. - **In-game voice chat:** Real-time communication with LINE friends without switching to another app. ## Overall Architecture - **LIFF** provides the in-app web interface and automatically exposes LINE login information such as `userId` and `displayName`. - **LINE Planet** handles WebRTC media processing and global network infrastructure. - **The web app** uses the LINE Planet SDK to implement the group call experience. - **The app server** issues LINE Planet access tokens. - Firebase Cloud Functions can provide the app-server layer without managing separate server infrastructure. - The developers are responsible mainly for connecting these components; LINE handles authentication, media transport, and much of the underlying infrastructure. ## Required Preparation - Use Node.js 20 LTS or later with npm. - Deploy over HTTPS; local development can use ngrok. - Create a Business ID, developer account, and Provider in the LINE Developers Console. - Create a LINE Official Account and enable its Messaging API. - Create a LINE Login channel under the same Provider and register a LIFF app. - Record the LIFF ID because it is required for initialization. - Set the LINE Login channel to **Published** for the `shareTargetPicker` API, which supports inviting LINE friends. - Request a LINE Planet Console account and service ID from the LINE Planet team. ## Designing and Generating Room IDs - LIFF can collect call setup information and register it with the app server, reducing the amount of pre-call configuration. - Users can join simply by entering or following a room ID. - The example generates a random 16-character alphanumeric ID using `crypto.randomUUID()`. - If a `roomId` query parameter exists in an invitation link, the app restores and uses that room instead. - The same design can later support fixed rooms based on interests or automatically generated rooms for user groups. ## Building the Preview Screen - The preview screen lets users check their camera and microphone before entering a call. - Instead of directly calling `getUserMedia`, the example uses PlanetKit’s `MediaStreamManager`. - A single `MediaStreamManager` instance is reused from preview through the conference, avoiding repeated permission requests. - Camera input is created with `createMediaStream()` or replaced with `changeVideoInputDevice()`. - Microphone muting changes the audio track’s `enabled` flag, preventing another permission prompt in mobile webviews. - Mobile users can switch between front and rear cameras by resolving the appropriate device ID. - The sample UI includes camera and microphone toggles, camera-flip controls for mobile devices, and an “Enter” action. - The article notes that the sample focuses on the essential flow; production applications still need stronger security, error handling, and performance optimization. The practical recommendation is to treat LIFF and LINE Planet as managed building blocks: implement the web call interface and a minimal token server, while relying on LINE for user identity and PlanetKit for real-time media.

Discord2026-06-093 min readCurated summary

How We Moved Discord Voice to the Edge

Discord migrated its voice and video infrastructure from roughly 30 hyperscaler regions to Cloudflare’s edge network, which spans more than 300 cities. The move brought measurable gains—over 80% of traffic now runs on Cloudflare, with Frankfurt seeing 34% lower ping and 42% lower packet loss—but the rollout exposed important limitations. Local server proximity alone is not enough; call placement and network peering are equally critical. ## Why Discord Moved Voice to the Edge - Traditional cloud regions left users in places such as Reykjavik, Auckland, Hawaii, and Lagos relatively far from voice servers. - Cloudflare’s 300-plus points of presence offered the possibility of hosting Discord’s software much closer to users. - Unlike typical CDN workloads, Discord needed to route live UDP packets for voice and video calls rather than cache static content. - More than 80% of Discord voice and video traffic now uses Cloudflare, and 70% of regions have improved year over year. ## Iceland: Local Servers Can Hurt Mixed Calls - Discord’s first test took place in Reykjavik, where users previously connected to servers in Rotterdam. - Iceland-only calls improved: - Ping decreased 9%. - Packet loss decreased 11%. - Mixed-region calls became worse: - Ping for non-Iceland participants increased 2.7 times. - Packet loss rose 9%. - Discord assigns one SFU to host an entire call, so all participants send traffic to that server. - A call started by one Icelandic user could therefore force German participants to route packets to Iceland and back. - Discord concluded that new edge locations help only when calls hosted there are primarily local; mixed calls require smarter host-placement logic. ## Rotterdam: Network Peering Was the Bottleneck - Discord next moved Rotterdam traffic to Cloudflare’s Amsterdam PoP. - Most regional ISPs performed normally, but Orange users experienced: - More than one second of latency during peak periods. - A 30% regression in voice freeze ratio. - The issue was not Cloudflare’s Amsterdam infrastructure itself, but the path between Orange and Cloudflare. - Traffic traveled through Telia’s transit backbone, where the Telia–Orange connection was already saturated. - Adding more traffic made the congestion worse. - Discord reverted the migration after about ten days. - Cloudflare pursued direct peering with Orange and added SFUs in Paris and London to provide shorter paths. ## A More Careful Migration Strategy - Discord changed its rollout process from capacity-based scheduling to peering-based analysis. - Before shifting meaningful traffic to a region, the team now checks whether Cloudflare has sufficient peering capacity with major local ISPs. - The migration slowed from a planned large-scale rollout to a region-by-region deployment. - The experience demonstrated that: - A geographically closer PoP does not always produce the best call experience. - SFU host placement matters for calls spanning multiple regions. - Transit routes and ISP peering can be more important than physical distance. Discord’s edge migration is succeeding, but only through incremental deployment, detailed traffic analysis, and improved call-placement decisions. The practical lesson is that low-latency infrastructure depends on the complete network path—not simply on adding servers closer to users.

OpenAI2026-05-035 min readCurated summary

How OpenAI delivers low-latency voice AI at scale

# How OpenAI Delivers Low-Latency Voice AI at Scale OpenAI rearchitected the WebRTC stack behind ChatGPT voice and the Realtime API to handle three problems that collided at scale: one-port-per-session media termination doesn't fit Kubernetes, ICE and DTLS sessions require stable ownership, and global routing must keep first-hop latency low. The solution is a split design in which a stateless UDP relay forwards packets to a stateful transceiver that owns the WebRTC session, which keeps standard client behavior intact while changing how traffic is routed internally. ## Why Voice AI Needs WebRTC - WebRTC standardizes the hard parts of real-time media: ICE and NAT traversal, DTLS and SRTP encryption, codec negotiation, RTCP quality control, echo cancellation, and jitter buffering. - Building on existing browser and mobile implementations lets the team focus on connecting real-time media to models. - Audio arrives as a continuous stream, so transcription, reasoning, tool calls, and speech generation can begin while the user is still talking. ## Choosing a Media Architecture - An SFU (selective forwarding unit) suits multiparty products such as group calls, but most OpenAI sessions are 1:1, with the user talking to one model. - The team chose a transceiver model: a WebRTC edge service terminates the client connection and converts media into simpler internal protocols for inference, transcription, speech generation, and orchestration. - The transceiver is the only service that owns WebRTC state (ICE checks, DTLS handshake, SRTP keys, session lifecycle), so backend services scale like ordinary services rather than acting as WebRTC peers. ## The Deployment Problem: WebRTC Meets Kubernetes The first implementation was a single Go service built on Pion that handled both signaling (SDP, codecs, ICE credentials) and media termination. Running it on Kubernetes exposed two problems: - **Port exhaustion:** One-port-per-session requires large public UDP port ranges. Cloud load balancers aren't built for tens of thousands of UDP ports per service, large ranges widen the attack surface, and pods that must reserve stable port ranges make autoscaling brittle. - **State stickiness:** ICE and DTLS are stateful, so every packet for a session must reach the process that created it. Otherwise setup fails or media breaks. The goal was a small, fixed public UDP surface that still routes each packet to the correct owning transceiver. ## Evaluated Approaches - **Unique IP:port per session (native direct UDP):** Direct media path, but requires one public port per session and fits Kubernetes and cloud load balancers poorly. - **Unique IP:port per server:** Small public footprint with one shared socket demultiplexing sessions, but across a load-balanced fleet the first packet can land on the wrong instance, so a deterministic steering mechanism is still needed. - **TURN relay (protocol-terminating):** Centralized edge policy, but allocations add setup round trips and are hard to move or recover. - **Stateless forwarder plus stateful terminator (chosen):** Small public UDP footprint and full session ownership in the transceiver, at the cost of one extra forwarding hop and custom coordination between relay and transceiver. ## Relay and Transceiver Architecture - The relay is a lightweight UDP forwarder. It does not decrypt media, run ICE, or take part in codec negotiation. It reads just enough packet metadata to pick a destination. - Signaling still goes to the transceiver. The SDP answer returns a shared relay VIP and port (for example, `203.0.113.10:3478`), giving the client one stable destination. - **First-packet routing on ICE ufrag:** The server-generated ICE username fragment (ufrag) is already exchanged during setup and echoed in STUN binding requests. OpenAI encodes routing hints (destination cluster and owning transceiver) into it, so the relay can route the first packet without an external lookup. - After the first packet, the relay caches a client-to-transceiver flow mapping in memory, and subsequent DTLS, RTP, and RTCP packets are forwarded without re-decoding the ufrag. - If a relay restarts, the next STUN packet rebuilds the session from the ufrag. A Redis cache of the client-to-transceiver mapping allows faster recovery before that packet arrives. - Each transceiver listens on a shared UDP socket rather than one socket per session. ## Global Relay and Geo-Steered Signaling - Once the public UDP surface was reduced to a few stable addresses, the same relay pattern could be deployed globally as "Global Relay" ingress points. - Cloudflare geo and proximity steering routes the initial HTTP or WebSocket signaling request to a nearby transceiver cluster, and the SDP answer advertises a nearby Global Relay address. - Packets enter the network close to the user, which lowers latency and jitter and avoids loss bursts before traffic reaches the backbone. - Together, these shorten signaling round trips and the first ICE connectivity check, reducing how long users wait before speech can start. ## Relay Implementation and Performance - The relay is written in Go and runs in userspace, reading packet headers from sockets and forwarding without terminating WebRTC. - **SO_REUSEPORT** lets multiple relay workers bind the same UDP port, with the kernel distributing packets across them to avoid a single read-loop bottleneck. - **runtime.LockOSThread** pins each UDP-reading goroutine to an OS thread. Combined with SO_REUSEPORT, this tends to keep each flow on one CPU core, improving cache locality and reducing context switches. - **Pre-allocated buffers and minimal copying** keep allocation and garbage-collection overhead low. - Kernel-bypass frameworks were considered but rejected as unnecessary, since this design handled global real-time traffic with a relatively small relay footprint. ## Results and Takeaways - WebRTC media now runs in Kubernetes without exposing thousands of UDP ports, which is easier to secure, load balance, and scale. - Clients still speak standard WebRTC, preserving browser and mobile interoperability. - The team's main lessons: - Preserve protocol semantics at the edge. - Keep hard session state in one place (the transceiver). - Route on information already present in setup, such as the ICE ufrag, rather than adding a hot-path lookup. - Optimize the common case before reaching for kernel bypass. The broader lesson is that complexity belongs in a thin routing layer, not in every backend service or in custom client behavior.

Meta2026-04-093 min readCurated summary

Escaping the Fork: How Meta Modernized WebRTC Across 50+ Use Cases

Meta escaped the “forking trap” by replacing its divergent WebRTC fork with a modular architecture based on the latest upstream release. The system builds legacy and current WebRTC versions side by side, enabling runtime A/B testing across more than 50 use cases before rollout. This improved performance, binary size, and security while establishing a repeatable process for continuous upstream upgrades. ## Why the WebRTC Fork Became a Problem - Meta’s RTC stack supports Messenger, Instagram video calls, Cloud Gaming, and Meta Quest casting. - Internal optimizations and bug fixes gradually caused its WebRTC fork to diverge from upstream. - As the fork accumulated custom changes, merging community improvements became increasingly expensive and risky. - A one-time upgrade was impractical because WebRTC serves billions of users across diverse devices and environments. ## Requirements for a Sustainable Upgrade Strategy - Meta needed to: - Run legacy and upstream-based WebRTC implementations simultaneously. - Dynamically assign users to either version for safe A/B testing. - Statically link both versions into the same application. - Maintain custom patches in a monorepo without repeatedly rebuilding the migration process. - Standard patch-file workflows were considered difficult to scale for Meta’s large codebase. ## Shim Layer and Dual-Stack Architecture - A shim library was placed between application code and WebRTC. - Applications call a unified, version-neutral API rather than calling either WebRTC implementation directly. - A runtime “flavor” configuration routes each call to either the legacy or latest implementation. - Shimming at the lowest practical layer avoided duplicating the higher-level call orchestration library: - Full duplication would have added about 38 MB uncompressed. - The shim-based design added roughly 5 MB, an 87% reduction. ## Resolving C++ Symbol Collisions - Linking two WebRTC copies normally violates the C++ One Definition Rule and creates thousands of duplicate symbols. - Meta automated namespace rewriting: - `webrtc::` in the current version became `webrtc_latest::`. - The legacy version became `webrtc_legacy::`. - Global functions, variables, and classes outside namespaces were moved into namespaces where possible or assigned flavor-specific names. - Macro conflicts, including `RTC_CHECK` and `RTC_LOG`, were addressed by: - Removing unnecessary includes. - Renaming infrequently used macros. - Sharing modules such as `rtc_base` between versions to reduce duplication and shimming work. ## Preserving Backward Compatibility - Renaming symbols could have broken existing call sites, especially code built for only one WebRTC flavor. - An initial solution forward-declared every required symbol, but this created a large and fragile maintenance burden. - The improved approach used C++ `using` declarations to bulk-import a flavor namespace into the familiar `webrtc::` namespace. - This preserved existing source-level APIs without adding binary overhead, while allowing Meta to migrate selected call sites incrementally. ## Runtime Flavor Dispatch - Shim adapters and converters must instantiate objects from either the legacy or current namespace. - A template-based helper library keeps shared adapter logic in one place. - Template specializations handle version-specific behavior. - A global flavor enum, initialized during application startup, determines which WebRTC implementation is used. - The design also supports single-flavor builds during the transition. Meta’s approach demonstrates that large internal modifications do not have to require a permanent fork. A low-level shim, automated renamespacing, compatibility imports, and template-based dispatch provide a practical foundation for continuously rebasing custom functionality onto upstream WebRTC while safely validating each release through A/B testing.

Discord2025-09-013 min readCurated summary

Bringing DAVE to All Discord Platforms

Discord is making DAVE, its end-to-end encryption protocol for audio and video calls, mandatory across all platforms. Browser support required solving WebRTC compatibility issues, designing an efficient Web Worker architecture, and reusing proven C++ cryptography through WebAssembly. Clients without DAVE support will be unable to join calls starting March 1, 2026. ## DAVE Becomes the Standard - DAVE already protects tens of millions of Discord calls daily. - Support is expanding to browsers, consoles, and the Social SDK. - Non-DAVE clients and applications will lose access to Discord calls on March 1, 2026. ## Browser Support and Firefox Compatibility - Discord uses the WebRTC Encoded Transform API to encrypt audio and video inside the WebRTC pipeline. - Firefox initially failed during real calls because its encryption Web Worker received no media data. - Discord engineers identified a recursive mutex deadlock in Firefox’s `FrameTransformerProxy`, triggered when video arrived too early. - Mozilla merged Discord’s fix, which is available in Firefox 142.0—the minimum Firefox version required for DAVE. ## Web Workers and Call State - Dedicated Web Workers encrypt and decrypt media: - One worker handles call audio and camera video. - Separate workers handle screenshare and game-stream audio and video. - Each media stream has a unique SSRC, allowing workers to select the correct symmetric encryption key for each frame. - Workers retain only essential call state, including SSRC-to-user mappings and encryption keys. - The main thread manages WebRTC connections, participants, and media tracks. - MLS membership changes are also handled on the main thread, preventing encryption work from delaying users joining or leaving calls. - Cryptographic state changes are sent asynchronously to workers. ## WebAssembly for Proven Cryptography - Discord compiled its existing, battle-tested C++ DAVE implementation to WebAssembly. - Reusing the same implementation across platforms reduces platform-specific security and reliability risks. - DAVE must selectively encrypt media while preserving metadata needed by WebRTC packetization and depacketization. - Since encrypted output cannot be modified in transit, byte-level parsing must be precise. - WebAssembly provides near-native performance while avoiding a more error-prone JavaScript reimplementation. ## WebAssembly Versus Browser Cryptography APIs - WebAssembly introduces a small performance cost compared with native browser APIs such as `SubtleCrypto`. - Discord’s benchmarks evaluate this trade-off against the benefits of shared, mature cryptographic code. - The post indicates that WebAssembly remains practical because frame parsing and selective encryption are computationally complex, while the security and portability benefits outweigh the minor cryptographic overhead. Discord’s platform transition means developers maintaining Discord clients, integrations, or SDK-based applications should add DAVE support before March 1, 2026. Browser users must also use Firefox 142.0 or newer when connecting through Firefox.

Datadog2025-06-243 min readCurated summary

How we built a real-time, client-side noise suppression library without server dependencies

Datadog’s CoScreen team needed high-quality noise suppression that could run in real time on client devices and integrate with WebRTC. Since existing solutions were either too slow, server-dependent, expensive, or difficult to embed, they built and open-sourced **dtln-rs**, a portable Rust library based on the DTLN model. It processes one second of audio in about 33 ms on an M1 MacBook Pro and supports WebAssembly, Node.js, and native clients. ## Introducing dtln-rs - dtln-rs is a lightweight, open-source noise reduction library based on the Dual-Signal Transformation LSTM Network (DTLN). - It can produce: - A WebAssembly module - A native Rust library - A Node.js native module - The library is designed to integrate with WebRTC-based applications. - Datadog also released a demo showing how to embed the filter in an application or webpage. ## Demonstrating Real-World Noise Suppression - The project was motivated by common remote-work disruptions, including lawn mowers and other background noise. - In one test, the filter removed a neighbor’s lawn mower so effectively that a colleague could not tell it was running. - The team used this result as evidence that the embedded library could provide meaningful value to CoScreen users. ## How DTLN Enables Real-Time Processing - AI noise suppression learns to distinguish desired speech from unwanted background sounds. - DTLN uses a short-time Fourier transform (STFT) to divide audio into smaller segments and analyze the magnitude of different frequencies. - It also uses phase information, which describes the starting position of each frequency in the sound wave. - A model analyzes magnitude and phase data to determine which parts are speech and which are noise. - Its LSTM-based architecture can adapt to different environments, such as: - Air-conditioner hum - Cafe conversations - Paper rustling - The combination of deep learning and efficient signal processing allows DTLN to operate with near-instantaneous latency. ## Why Existing Noise Suppression Solutions Were Insufficient - Many advanced machine-learning models require powerful backend servers, with processed audio sent back over the network. - This approach adds latency, infrastructure complexity, and operating costs. - WebRTC remains widely adopted but generally relies on older, built-in noise reduction techniques. - Earlier solutions such as RNNoise can reduce noise but often do not match the quality of newer commercial systems. - Although Web Audio and WebAssembly make custom client-side processing possible, implementation still requires substantial engineering effort. - Large companies can deploy specialized servers and models trained on enormous speech datasets, but smaller teams may not have the resources to do so. - CoScreen’s search for an alternative led to DTLN, which could run in real time on standard hardware and be embedded directly into client applications. ## Practical Recommendation For WebRTC applications needing client-side, real-time noise suppression, dtln-rs offers a portable alternative to expensive server-based services. Its Rust foundation and support for WebAssembly, Node.js, and native targets make it suitable for web, desktop, and embedded clients.