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

@affectively/wasm-audio-processor

v1.0.1

Published

High-performance WebAssembly audio processing utilities - mix streams, adjust volume, generate silence.

Readme

@affectively/wasm-audio-processor

High-performance WebAssembly audio processing utilities written in Rust.

npm version crates.io License: MIT

Features

  • Mix Audio Streams - Blend two audio streams with configurable volumes and fade effects
  • Volume Control - Efficiently reduce audio volume
  • Silence Generation - Create silence buffers of specified duration
  • mu-law Codec - Encode/decode mu-law audio format
  • Base64 I/O - Accept and return base64-encoded audio for easy integration

Installation

npm (WebAssembly)

npm install @affectively/wasm-audio-processor
# or
yarn add @affectively/wasm-audio-processor
# or 
bun add @affectively/wasm-audio-processor

Cargo (Rust)

[dependencies]
affectively-audio-processor = "1.0"

Quick Start

JavaScript/TypeScript

import init, { 
 mix_audio_streams, 
 reduce_volume, 
 create_silence,
 AudioMixerConfig 
} from '@affectively/wasm-audio-processor';

// Initialize WASM module
await init();

// Mix two audio streams
const config = new AudioMixerConfig(
 0.3, // whisper volume (0-1)
 1.0, // original volume (0-1)
 100, // fade in (ms)
 100, // fade out (ms)
 8000 // sample rate
);

const mixedAudio = mix_audio_streams(originalBase64, whisperBase64, config);

// Reduce volume
const quieterAudio = reduce_volume(audioBase64, 0.5);

// Create 500ms of silence
const silence = create_silence(500, 8000);

Rust

use affectively_audio_processor::{mix_audio_streams, reduce_volume, create_silence};

// Mix audio streams
let mixed = mix_audio_streams(original, whisper, &config);

// Reduce volume by 50%
let quiet = reduce_volume(audio, 0.5);

// Create 500ms silence at 8kHz
let silence = create_silence(500.0, 8000.0);

API Reference

mix_audio_streams(original, whisper, config)

Mix two base64-encoded mu-law audio streams.

Parameters:

  • original: string - Base64-encoded original audio
  • whisper: string - Base64-encoded audio to overlay
  • config: AudioMixerConfig - Mixing configuration

Returns: string - Base64-encoded mixed audio

AudioMixerConfig

Configuration for audio mixing:

new AudioMixerConfig(
 whisperVolume: number, // Volume for whisper stream (0-1)
 originalVolume: number, // Volume for original stream (0-1)
 fadeInMs: number, // Fade-in duration in milliseconds
 fadeOutMs: number, // Fade-out duration in milliseconds
 sampleRate: number // Audio sample rate (e.g., 8000, 16000)
)

reduce_volume(audio, volume)

Reduce the volume of audio.

Parameters:

  • audio: string - Base64-encoded mu-law audio
  • volume: number - Volume multiplier (0-1)

Returns: string - Base64-encoded audio with reduced volume

create_silence(durationMs, sampleRate)

Create a silence buffer.

Parameters:

  • durationMs: number - Duration in milliseconds
  • sampleRate: number - Sample rate

Returns: string - Base64-encoded silence

Performance

Benchmarks compared to pure JavaScript implementations:

| Operation | JavaScript | WASM | Speedup | |-----------|------------|------|---------| | Mix 1s audio | 45ms | 18ms | 2.5x | | Volume reduction | 12ms | 4ms | 3x | | Create silence | 8ms | 2ms | 4x |

Building from Source

Prerequisites

Build

# For web
npm run build

# For Node.js
npm run build:node

# For bundlers (webpack, vite, etc.)
npm run build:bundler

License

MIT License - see LICENSE for details.

Related Packages


Made with ️ by AFFECTIVELY