AbsoluteJS

Media

@absolutejs/mediav0.0.1-beta.24betaVoice & Media

Low-level realtime media primitives — frames, transports, processor graphs, noise suppression, and health reports — for builders of voice pipelines.

@absolutejs/media provides the low-level realtime media layer that voice products build on: generic media frames, transports, processor graphs, calibration, resampling, speech activity, and interruption reports. It also ships noise suppression (energy gate, FFmpeg, Krisp-style frame processors) and compact artifact helpers that summarize media health into small JSON + Markdown reports. Product-specific voice routes and provider orchestration stay in @absolutejs/voice, which consumes this package.

#Installation

BASH
bun add @absolutejs/media

#Capabilities

Overview

@absolutejs/media provides low-level realtime media primitives for AbsoluteJS packages.

It owns generic media frame, transport, processor graph, calibration, resampling, speech activity, and interruption reports. Product-specific voice routes, readiness gates, provider orchestration, operations records, and proof-pack integrations stay in @absolutejs/voice.

Media frames

Use transports and processor graphs to move and transform frames, then build calibration, VAD, interruption, quality, WebRTC, and continuity reports at the boundaries your application operates.

See MEDIA_PLAN.md for the media runtime roadmap. Voice-specific product needs live in ../voice/VOICE_PLAN.md.

Frames and transports

A shared MediaFrame shape for input audio, assistant audio, transcripts, interruptions, and metadata, with createMediaTransport for lifecycle- and event-tracked delivery.

Processor graphs

createMediaProcessorGraph wires nodes with branch routing, fan-in joins, backpressure strategies, and per-node timing reports.

Noise suppression

Energy-gate, pass-through, FFmpeg, and frame-processor (Krisp-style) suppressors behind one NoiseSuppressor contract, composable in sequence.

Telephony stream helpers

Parse and serialize telephony envelopes from Twilio, Telnyx, and Plivo streams into media frames and lifecycle reports.

Health reports

Quality, transport, VAD, interruption, WebRTC stats, and pipeline calibration reports with pass / warn / fail statuses you can gate on.

Compact artifacts

Summarize, render to Markdown, redact, and persist reports as compact side-by-side .json + .md artifacts with stable issueCodes.

Outcomes

What you can build

Overview

@absolutejs/media provides low-level realtime media primitives for AbsoluteJS packages.

Media frames

Use transports and processor graphs to move and transform frames, then build calibration, VAD, interruption, quality, WebRTC, and continuity reports at the boundaries your application operates.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/media version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/media example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Media frames

Partial snippet

Working example for Media frames.

TS
import { createMediaFrame } from '@absolutejs/media';

const pcmBytes = new Uint8Array(320);
const frame = createMediaFrame({
	at: Date.now(),
	audio: pcmBytes,
	durationMs: 20,
	id: 'frame-1',
	kind: 'input-audio',
	source: 'browser'
});

#Quick Start

Partial snippet

Plan format conversion between transports and clean up inbound audio with the energy-gate noise suppressor.

TS
import {
	buildMediaResamplingPlan,
	createEnergyGateNoiseSuppressor
} from '@absolutejs/media';

// Plan a resample between transport and provider formats
const plan = buildMediaResamplingPlan({
	inputFormat: {
		channels: 1,
		container: 'raw',
		encoding: 'mulaw',
		sampleRateHz: 8000
	},
	outputFormat: {
		channels: 1,
		container: 'raw',
		encoding: 'pcm_s16le',
		sampleRateHz: 16000
	}
});
console.log(plan.required, plan.ratio, plan.status);

// Gate out background noise before it reaches your STT provider
const suppressor = createEnergyGateNoiseSuppressor({ thresholdRms: 0.02 });

const { bytes } = await suppressor.process({
	format: {
		channels: 1,
		container: 'raw',
		encoding: 'pcm_s16le',
		sampleRateHz: 16000
	},
	pcm: pcmChunk // ArrayBuffer | ArrayBufferView from your transport
});

#Health Report Artifacts

Partial snippet

Turn a media quality report into a compact, array-free summary plus readable Markdown, and persist both as artifacts.

TS
import {
	buildMediaQualityArtifact,
	buildMediaQualityReport,
	writeMediaArtifact
} from '@absolutejs/media';

const report = buildMediaQualityReport({ frames });

// { json, jsonValue, markdown, summary } in a single call
const artifact = buildMediaQualityArtifact(report);

if (artifact.summary.issueCodes.length > 0) {
	console.warn('media issues:', artifact.summary.issueCodes);
}

// Persists media-quality.json + media-quality.md side by side
await writeMediaArtifact({
	dir: '.media-artifacts',
	json: artifact.json,
	markdown: artifact.markdown,
	slug: 'media-quality',
	summary: artifact.summary
});
Beta
This package is in beta; the frame, transport, and report shapes may still shift between releases.
Where it sits
Media is the substrate layer. If you want voice agents, readiness gates, or provider orchestration, reach for @absolutejs/voice — it consumes these primitives for you.

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

80 symbols
applyAudioRedactionexportPermalink
TS
applyAudioRedaction
Exported from @absolutejs/media

Current package surface

What ships today

@absolutejs/mediav0.0.1-beta.24 · betaVoice & MedianpmSource
3entry points81symbols

Import surface · click to copy