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

waa-play

v0.2.2

Published

Web Audio API modules with WSOLA time-stretching, chunk-based streaming, and waveform extraction

Readme

waa-play

npm version

Web Audio API modules with WSOLA time-stretching, chunk-based streaming, and waveform extraction

waa-play は Web Audio API を用いた音声操作のためのモジュール群です。ピッチ保持タイムストレッチ、ストリーミング再生、波形抽出、AudioNode チェーン接続などの機能を提供します。

Web Audio API の playbackRate で再生速度を変更するとピッチも連動して変化します。waa-play は、ピッチを保持したまま再生速度を変えたいユースケースのために作成しました。

この実装は完璧なものではなく、すべてのユースケースに対応するわけではないことに注意してください。

Documentation & Demo

https://ivgtr.github.io/waa/

ピッチ保持タイムストレッチ(WSOLA)

waa-play は WSOLA (Waveform Similarity Overlap-Add) アルゴリズムを採用しています。 音声信号を小さなフレームに分割し、類似した波形を重ね合わせて再構築することで、ピッチを変えずに時間的な伸縮を実現します。

HTML5 Audio 要素の preservePitch オプションと同様の効果を目指していますが、いくつかの制約があります。 WSOLA の処理はクライアントサイドで行われるため、CPU リソースを多く消費する可能性があります。 また、AudioBuffer 全体を事前に読み込む必要があるため、長い音声ファイルでは変換に時間がかかる場合があります。

これらの制約に対して、Worker による並列処理やチャンクベースのストリーミングで対処しています。

Worker ベースの変換

WSOLA 変換は Web Worker 内で実行され、メインスレッドのパフォーマンスへの影響を最小限に抑えています。 Worker は複数生成され、変換タスクがキューイングされて効率的に処理されます。

チャンクベースのストリーミング再生

変換済みの音声がチャンク単位で順次再生されます。 これにより、長時間の音声でもすべての変換を待つことなく、スムーズな再生が可能です。

イベント通知

再生位置の更新や再生終了などのイベントが通知され、UI の更新や他の処理に利用できます。

Quick Start

npm install waa-play

最も簡単な使い方(WaaPlayer)

WaaPlayerAudioContext を内部管理し、全モジュールの機能を統合して提供します。

import { WaaPlayer } from "waa-play";

const player = new WaaPlayer();
const buffer = await player.load("/audio/track.mp3");

const gain = player.createGain(0.8);
const playback = player.play(buffer, { through: [gain] }); // 再生

playback.setPlaybackRate(1.5); // 再生速度を 1.5 倍に変更(リアルタイム反映)

playback.on("timeupdate", ({ position, duration }) => {
  console.log(`${position.toFixed(2)}s / ${duration.toFixed(2)}s`);
});

playback.dispose(); // 再生停止・リソース解放

既存の AudioContext を渡すこともできます。これは例えば、他の AudioNode と接続したい場合に有用です。

const player = new WaaPlayer(existingAudioContext);

License

MIT © ivgtr

Twitter Follow MIT License