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

vite-combine-audio

v1.0.9

Published

Combines audio files into a single file to be used as an audio sprite

Readme

vite-combine-audio

Vite support to combine audio files using ffmpeg to be used as an audio sprite file in a library like howler.

Installation

Install by running the npm command

npm install vite-combine-audio

Then use it in your Vite configuration like this:

// vite.config.js
import combineAudio from 'vite-combine-audio';

export default {
  plugins: [combineAudio()],
};

Considerations

  • This Plugin requires Node 14.0 or higher
  • This Plugin will install a version of ffmpeg which is required for the file merging

Configuration

Below are the options that can be passed into the combineAudio function, all are optional and have default values set.

{
  fileRegex?: RegExp; // Regex to match audio files (default: /\.mp3$/)
  outputTypes?: string[]; // File output types (default: ['.mp3', '.webm'])
  filename?: string; // Filename for the merged audio file (default: 'merged-audio')
  tempDir?: string; // Temporary directory (default: 'temp/audio')
  outputDir?: string; // Output directory (default: 'dist/audio')
}

Output

When importing audio clips in your vite project, they will be converted in to the following object structure in order to access the audio sprite timing.

  {
    output: String; // File path for the merged audio file
    filename: String; // Original file name of the audio clip
    startTime: Number; // The start time of the audio clip in the merged file
    duration: Number; // The duration of the audio clip
  }

Use with Howler sound library

This tool was designed to be used with the HowlerJS library and can be used as shown below.

  // Import sound files
  import soundClip1 from '../../assets/sounds/soundClip1.mp3';
  import soundClip2 from '../../assets/sounds/soundClip2.mp3';

  // Create Howler object
  var audio = new Howl({
    src: soundClip1.output,
    sprite: {
      [soundClip1.filename]: [soundClip1.startTime, soundClip1.duration],
      [soundClip2.filename]: [soundClip2.startTime, soundClip2.duration],
    }
  });

  // Function to play the sounds
  function playSound (soundName){
    audio.play(soundName)
  }

  // Calling the play sound functions
  playSound(soundClip1.filename);
  playSound(soundClip2.filename);