Files
suaveplan/packages/media/audio/audio-sprite-packer
2026-05-27 23:47:53 +01:00
..
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00
2026-05-27 23:47:53 +01:00

@suaveplan/audio-sprite-packer - Binary audio sprite map packer with 80%+ compression versus individual files: pack multiple audio clips into a single concatenated binary with a compact JSON manifest.

Universal audio sprite packer with injectable adapter, Zod-validated boundaries, and OpenTelemetry instrumentation. Zero browser or Node.js dependencies.

Documentation tree

  • benchmarks — This benchmark suite measures the throughput of AudioSpritePacker.pack under varying clip counts using `NullAudioAdap…
    • audio-sprite-packer.bench — This benchmark suite measures the throughput of AudioSpritePacker.pack under varying clip counts using `NullAudioAdap…
  • null-adapter — NullAudioAdapter is a deterministic, test-only implementation of the AudioAdapter interface. It produces predictabl…
    • null-adapter — NullAudioAdapter is a deterministic, test-only implementation of the AudioAdapter interface. It produces predictabl…
  • audio-sprite-packer — AudioSpritePacker is the primary orchestrator for combining multiple audio clips into a single concatenated buffer wi…
    • audio-sprite-packer — AudioSpritePacker is the primary orchestrator for combining multiple audio clips into a single concatenated buffer wi…
  • error-codes — This module centralises every error code, metadata description, and severity level that the `@suaveplan/audio-sprite-pa…
    • error-codes — This module centralises every error code, metadata description, and severity level that the `@suaveplan/audio-sprite-pa…
  • types — This module defines the public-facing TypeScript interfaces, Zod boundary schemas, and runtime types shared across the…
    • common — This module defines the public-facing TypeScript interfaces, Zod boundary schemas, and runtime types shared across the…
  • manifest — This module assembles and validates AudioSpriteManifest objects. buildManifest creates a manifest from packed entri…
    • manifest — This module assembles and validates AudioSpriteManifest objects. buildManifest creates a manifest from packed entri…

Install

bun add @suaveplan/audio-sprite-packer

Quick start

import { AudioSpritePacker, NullAudioAdapter } from "@suaveplan/audio-sprite-packer";

const packer = new AudioSpritePacker({ adapter: new NullAudioAdapter() });

const sprite = await packer.pack([
  { name: "jump", data: jumpBytes },
  { name: "land", data: landBytes },
  { name: "coin", data: coinBytes },
]);

// Retrieve individual clips by name.
const jump = packer.unpack(sprite, "jump");
console.log(jump.length); // encoded byte length

Modules