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

live2d-motionsync

v0.0.4

Published

Live2D Motionsync, a lip-sync library for Live2D models.

Readme

live2d-motionsync

中文文档

A live2d motionsync library

demo

codesandbox demo

Prerequisites

  1. Only support Cubism 4 models

  2. Models need to support motionsync3

    Reference: https://docs.live2d.com/en/cubism-editor-manual/motion-sync/

Install

npm install live2d-motionsync

Usage

Install pixi-live2d-display

npm install pixi-live2d-display [email protected]
import * as PIXI from "pixi.js";
import { Live2DModel } from "pixi-live2d-display";
import { MotionSync } from "live2d-motionsync";

// expose PIXI to window so that this plugin is able to
// reference window.PIXI.Ticker to automatically update Live2D models
window.PIXI = PIXI;

(async function () {
  const app = new PIXI.Application({
    view: document.getElementById("canvas"),
  });

  const model = await Live2DModel.from("kei_vowels_pro.model3.json");

  // init motionsync
  const motionSync = new MotionSync(model.internalModel);
  // load motionsync file
  motionSync.loadMotionSyncFromUrl("kei_vowels_pro.motionsync3.json");
  // if no motionsync3 file, load default motionsync3 config
  // motionSync.loadDefaultMotionSync();

  // ensure page interaction
  // play audio
  motionSync.play("/audio/test.wav").then(() => {
    console.log("play end");
  });
  // stop audio
  // motionSync.stop();

  app.stage.addChild(model);

  // transforms
  model.x = 100;
  model.y = 100;
  model.rotation = Math.PI;
  model.skew.x = Math.PI;
  model.scale.set(2, 2);
  model.anchor.set(0.5, 0.5);

  // interaction
  model.on("hit", (hitAreas) => {
    if (hitAreas.includes("body")) {
      model.motion("tap_body");
    }
  });
})();

MotionSync API

constructor(internalModel: any)

Initialize a new MotionSync instance.

  • Parameters:

    • internalModel: The internal model object containing the core model and other necessary components.
  • Description:

    • This constructor uses the provided internalModel to initialize the MotionSync class and start and initialize the CubismMotionSync framework.

async play(src: string | AudioBuffer): Promise<void>

  • Return:

    • Promise<void>: A Promise that resolves when the audio playback ends.

Play audio from specified source.

  • Parameters:

    • src: The audio source, which can be a URL string or an AudioBuffer object.
  • Description:

    • This method loads audio from the given source and starts playback. It returns a Promise that resolves when the audio playback ends.

reset()

Reset the MotionSync instance to its initial state.

  • Description:
    • This method stops any ongoing audio playback and resets the mouth state.

loadMotionSync(buffer: ArrayBuffer, samplesPerSec = SamplesPerSec)

Load motion sync data from ArrayBuffer.

  • Parameters:

    • buffer: The ArrayBuffer containing the motion sync data.
    • samplesPerSec: The sample rate of the audio data (default is 48000).
  • Description:

    • This method uses the provided motion sync data to initialize the CubismMotionSync instance.

async loadDefaultMotionSync(samplesPerSec = SamplesPerSec)

Load default motion sync data.

  • Parameters:

    • samplesPerSec: The sample rate of the audio data (default is 48000).
  • Description:

    • This method loads the default motion sync data from a predefined URL.

async loadMotionSyncFromUrl(url: string, samplesPerSec = SamplesPerSec)

Load motion sync data from URL.

  • Parameters:

    • url: The URL of the motion sync data.
    • samplesPerSec: The sample rate of the audio data (default is 48000).
  • Description:

    • This method fetches the motion sync data from the specified URL and initializes the CubismMotionSync instance. If the fetch fails, it falls back to loading the default motion sync data.
  • pixi-live2d-display