New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

lipsync-js

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lipsync-js

A powerful library for processing audio files and generating mouth shapes for lip-sync animations.

latest
npmnpm
Version
1.0.5
Version published
Weekly downloads
24
71.43%
Maintainers
1
Weekly downloads
 
Created
Source

lipsync-js

lipsync-js

Version

1.0.5

Note: This version doesn't work as expected. we are facing an accuracy problem and are working on it.

Introduction

lipsync-js is a powerful library for processing WAV audio files and generating mouth shapes for lip-sync animations. It uses Fast Fourier Transform (FFT) and Short-Time Fourier Transform (STFT) to analyze the audio data and map it to predefined mouth shapes, enabling realistic lip-syncing for animated characters.

Features

  • Audio Processing: Analyzes WAV audio files to extract frequency and magnitude data.
  • Mouth Shape Mapping: Maps audio data to mouth shapes based on frequency ranges.

Installation

Install the library using npm:

npm install lipsync-js

Usage Example Usage

import processAudioFile from "lipsync-js";

// Accepts only WAV files
async function handleAudioFile(buffer) {
    try {
        // Call the processAudioFile with the WAV buffer
        // and it will return the mouthCues
        const mouthCues = await processAudioFile(buffer);
        console.log(mouthCues);
    } catch (err) {
        console.error("Error processing audio file:", err);
    }
}

The processAudioFile function returns an array of mouth cues with start and end times, and the corresponding mouth shape. This can be used to animate 3D avatars on the web.

Example Output:

[
    { start: "0.00", end: "0.05", value: "closed mouth" },
    { start: "0.05", end: "0.27", value: "open mouth" },
    { start: "0.27", end: "0.31", value: "idle position" },
    { start: "0.31", end: "0.43", value: "idle position" },
    { start: "0.43", end: "0.47", value: "idle position" },
];

morph

Community and Contributions

lipsync-js is a community project open to the public. Contributions, feedback, and participation are welcome and encouraged. Together, we can improve and expand the capabilities of this library to benefit everyone.

© 2024 lipsync-js contributors. This project is licensed under the MIT License.

Feel free to let me know if you need any further changes!

Keywords

audio

FAQs

Package last updated on 04 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts