Skip to content

Audio helpers

UI ยท v0.1.0

The pure audio helpers the voice UI kits share: resampling, PCM16 conversion, fixed-duration chunking, levels and base64. No browser APIs, so they run and test anywhere.

Installed for you

With player, transcriber. Open it to build a kit on top of it.

Install copit add @chanx-kit-ui/audio
Or with shadcn npx shadcn add https://huynguyengl99.github.io/chanx-kit/r/audio.json
npm packages
Source ui/audio

The pure functions the voice UI kits share. Installed with them; useful on their own when you handle PCM audio in the browser.

copit add @chanx-kit-ui/audio
Export
Resampler linear-interpolation resampler that keeps its position across blocks
toPcm16, fromPcm16 float samples to little-endian PCM16 bytes and back (downmixing)
Chunker collects bytes into chunks of a fixed duration
level RMS of a block, for meters
toBase64, fromBase64 standard base64, using the native Uint8Array methods when present