Overview
@absolutejs/media provides low-level realtime media primitives for AbsoluteJS packages.
@absolutejs/mediav0.0.1-beta.24betaVoice & MediaLow-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.
bun add @absolutejs/media@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.
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.
A shared MediaFrame shape for input audio, assistant audio, transcripts, interruptions, and metadata, with createMediaTransport for lifecycle- and event-tracked delivery.
createMediaProcessorGraph wires nodes with branch routing, fan-in joins, backpressure strategies, and per-node timing reports.
Energy-gate, pass-through, FFmpeg, and frame-processor (Krisp-style) suppressors behind one NoiseSuppressor contract, composable in sequence.
Parse and serialize telephony envelopes from Twilio, Telnyx, and Plivo streams into media frames and lifecycle reports.
Quality, transport, VAD, interruption, WebRTC stats, and pipeline calibration reports with pass / warn / fail statuses you can gate on.
Summarize, render to Markdown, redact, and persist reports as compact side-by-side .json + .md artifacts with stable issueCodes.
Outcomes
@absolutejs/media provides low-level realtime media primitives for AbsoluteJS packages.
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
Follow in order
Working example for Media frames.
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'
});Plan format conversion between transports and clean up inbound audio with the energy-gate noise suppressor.
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
});Turn a media quality report into a compact, array-free summary plus readable Markdown, and persist both as artifacts.
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
});Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.
Current package surface
Import surface · click to copy