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/decode-wavpack

v2.0.0

Published

Decode WavPack (.wv) audio with libwavpack WASM

Readme

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

Decode WavPack (.wv) to PCM float samples

npm install @audio/decode-wavpack
import decode, { decoder } from '@audio/decode-wavpack'

libwavpack (the reference WavPack 5 implementation, David Bryant) compiled to a single-file WASM ES module — no side files, loads from any CDN, Node, workers and AudioWorklets. Handles everything the format defines: lossless and hybrid/lossy, 8/16/24/32-bit integer and 32-bit float, mono through multichannel, and DSD-as-PCM (OPEN_DSD_AS_PCM, decimated to 24-bit PCM by the library). Streaming decode drives libwavpack's own block reader through a memory-backed WavpackStreamReader64, so multichannel block groups and adaptive decorrelation state are handled exactly as the reference library handles them — this package only tracks byte-level block boundaries.

let { channelData, sampleRate } = await decode(wvBytes)

let dec = await decoder()
let head = dec.decode(chunk1)   // synchronous; partial blocks carry over
let tail = dec.flush()          // drops an incomplete trailing block, if any
dec.free()

| Export | | | |---|---|---| | decode(src) | Promise<AudioData> | Whole-stream decode | | decoder() | Promise<{decode, flush, free}> | Streaming decoder; decode(chunk) is synchronous |

AudioData is { channelData: Float32Array[], sampleRate: number }, samples in [-1, 1]. Integer PCM is scaled by 2^(bits-1) (asymmetric, matching WAV convention: max positive sample maps to <1, max negative to exactly -1); float PCM is a direct bit reinterpretation (WavPack stores float samples pre-normalized when opened with OPEN_NORMALIZE, which this package always sets). Channels come out in the order libwavpack reports them, which for standard Microsoft-ordered sources (anything ffmpeg or the WavPack CLI produces) is WAV order: FL, FR, FC, LFE, BL, BR, ...

decode() drains every sample libwavpack can produce from the blocks fed so far, every call — there's no encoder lookahead or block-spanning delay to hold back, so flush() only ever discards an incomplete trailing block (a stream cut off mid-block) and returns nothing new.

Hybrid/lossy WavPack (-b<n>) decodes at whatever quality it was encoded at; the .wvc correction file (lossless-hybrid two-file mode) is not read — only the standalone .wv bitstream. A garbage or non-WavPack input throws instead of returning empty/wrong data.

Use when: you need a from-scratch, spec-accurate WavPack decoder in the browser or Node — audio tools reading .wv files, WavPack-in-container demuxers, or any pipeline that already speaks @audio's {channelData, sampleRate} shape.


Part of @audio/decode — the decode family umbrella.

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