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

@mogamitsuchikawa/lipsync-wasm

v0.1.1

Published

Reusable lip sync track computation package powered by Rust and WebAssembly

Readme

@mogamitsuchikawa/lipsync-wasm

Rust + WebAssembly で LipSync トラックを計算する npm パッケージです。 通常利用では Rust は不要で、同梱済み WASM をそのまま利用できます。

Install

npm install @mogamitsuchikawa/lipsync-wasm
  • 対応環境: Node.js >=18, npm >=9
  • 利用時に Rust / wasm-pack は不要

Quick Start

import {
  initLipSync,
  computeTrackFromWavBase64,
  sampleTrack,
  createLipSyncSmoother
} from "@mogamitsuchikawa/lipsync-wasm";

await initLipSync();

const track = await computeTrackFromWavBase64(wavBase64, { fps: 30 });
const frame = sampleTrack(track, audio.currentTime);

const smoother = createLipSyncSmoother();
const smoothed = smoother.smooth(frame, 1 / 30);

WASM 配信 URL を明示する場合(Vite など):

import { initLipSync } from "@mogamitsuchikawa/lipsync-wasm";
import lipsyncWasmUrl from "@mogamitsuchikawa/lipsync-wasm/wasm/lipsync_wasm_bg.wasm?url";

await initLipSync({ wasmUrl: lipsyncWasmUrl });

API

initLipSync(opts?)

WASM モジュールを初期化します。

type InitLipSyncOptions = {
  wasmUrl?: WebAssembly.Module | BufferSource | Response | Promise<Response> | string | URL;
};
  • 事前に await initLipSync() を 1 回実行
  • URL 解決に不安がある bundler では wasmUrl を明示

computeTrackFromWavBase64(wavBase64, opts?)

Base64 エンコード済み WAV から LipSyncTrack を計算します。

const track = await computeTrackFromWavBase64(wavBase64, { fps: 30 });
  • fps1..120 にクランプ
  • 返却値 LipSyncTrackphonemeIndices / rawVolumes / volumeScale を含む

sampleTrack(track, currentTimeSeconds)

任意時刻のフレームをサンプリングします。

const frame = sampleTrack(track, audio.currentTime);
// frame: { frameIndex, phonemeIndex, intensity } | null
  • track が空の場合は null
  • intensity0..1 に正規化

createLipSyncSmoother(options?)

sampleTrack 結果を平滑化する stateful API を作成します。

const smoother = createLipSyncSmoother({
  attackSeconds: 0.04,
  releaseSeconds: 0.12,
  silenceReleaseSeconds: 0.2,
  silenceThreshold: 0.03,
  minOpen: 0.12,
  volumeNormalization: "none" // or "log10"
});

const smoothed = smoother.smooth(frame, deltaSeconds);
smoother.reset();
  • smooth(frame, deltaSeconds?){ phonemeIndex, intensity } を返却
  • reset() で内部状態を初期化

開発者向け(WASM 再生成が必要な場合のみ)

通常のライブラリ利用者はこの手順は不要です。

必要ツール

rustup target add wasm32-unknown-unknown
cargo install wasm-pack

よく使うコマンド

make install
make check-wasm
make build-wasm
make build
make verify
  • make verify: WASM チェック + 型チェック + ライブラリ build + example build
  • make publish-check: npm pack --dry-run で公開内容確認

Troubleshooting

failed to initialize lipsync wasm: Failed to execute 'compile' on 'WebAssembly': HTTP status code is not ok

.wasm URL 解決が失敗し、404 で取得できない時に発生します。

import { initLipSync } from "@mogamitsuchikawa/lipsync-wasm";
import lipsyncWasmUrl from "@mogamitsuchikawa/lipsync-wasm/wasm/lipsync_wasm_bg.wasm?url";

await initLipSync({ wasmUrl: lipsyncWasmUrl });

Vite 利用時は prebundle 回避のため optimizeDeps.exclude も推奨です。

import { defineConfig } from "vite";

export default defineConfig({
  optimizeDeps: {
    exclude: ["@mogamitsuchikawa/lipsync-wasm"]
  }
});

computeTrackFromWavBase64 が失敗する

  • 入力が PCM ではなく WAV(base64) か確認
  • data:audio/wav;base64, のプレフィックスを除去して渡す

Public npm Publish

公開運用の詳細チェックリストは PUBLISHING.md を参照してください。

初回公開

make install
make verify
make publish-check
npm login
npm publish --access public

更新公開

npm version patch
make verify
make publish-check
npm publish

License

MIT License. 詳細は LICENSE を参照してください。