npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@audio/encode-wavpack

v1.0.2

Published

Encode PCM audio samples to WavPack (.wv) with libwavpack WASM

Readme

@audio/encode-wavpack npm BSD-3-Clause

Encode PCM audio samples to WavPack (.wv)

npm install @audio/encode-wavpack
import wavpack from '@audio/encode-wavpack'

libwavpack (the reference WavPack 5 implementation, David Bryant) compiled to a single-file WASM ES module, encode-only (no file-input/decode side, no DSD — a leaner build than the full library). Lossless by default; hybrid/lossy on request. Block boundaries are decided purely by cumulative sample count, so output is byte-identical no matter how the input is chunked across encode() calls.

let enc = await wavpack({ sampleRate: 48000, channels: 2, bitDepth: 16 })
let chunk = enc.encode(channelData)  // → Uint8Array (any WavPack blocks this chunk completed)
let tail = enc.flush()               // → Uint8Array (final block + APEv2 tag; frees the encoder)
// concatenate chunk + tail for the complete .wv file

| Option | Default | | |---|---|---| | sampleRate | — | Required | | channels | 1 | | | bitDepth | 16 | 16, 24, 32 (integer) or 'float' (32-bit IEEE-754) | | hybrid | false | Bitrate-per-sample (< 24, e.g. 4 ≈ 4 bits/sample) or kbps (≥ 24) — enables lossy hybrid mode. No .wvc correction file. | | extraProcessing | 0 | 0-6, libwavpack's extra-processing level (xmode) | | highQuality | false | | | veryHigh | false | Implies highQuality | | fast | false | | | blockSamples | library default | Fixed WavPack block size, 16-131072 samples | | meta | — | APEv2 tags: title, artist, album, albumartist, composer, genre, year, track, disc, comment, copyright, isrc, publisher, software, lyrics, pictures: [{mime, description, data}] (written as Cover Art (Front)) |

Streaming

let enc = await wavpack({ sampleRate: 44100, channels: 1, bitDepth: 16 })
let a = enc.encode(chunk1)  // → Uint8Array (blocks completed so far, maybe empty)
let b = enc.encode(chunk2)
let c = enc.flush()         // → Uint8Array (final block + tag)
// complete file = concat(a, b, c)

encode() returns whatever WavPack blocks were completed by that call — often nothing, since a block only closes once it has enough samples (blockSamples, or a size the library picks from the sample rate). flush() finalizes the last partial block, writes the APEv2 tag if meta was given, and frees the encoder — it must be the last call.

License

ॐ · BSD-3-Clause, inherited from the bundled libwavpack.