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 🙏

© 2025 – Pkg Stats / Ryan Hefner

purify-voice

v1.0.9

Published

Professional audio denoising for JavaScript using RNNoise - works with React, Vue, Angular, and vanilla JS

Downloads

936

Readme

Purify Voice

🎙️ Professional audio denoising for JavaScript

npm version License: MIT

Powered by RNNoise - Deep learning-based noise suppression

✨ Features

  • 🎯 High-Quality Denoising - Uses RNNoise deep learning algorithm
  • 🚀 WebAssembly Powered - Fast, efficient processing
  • ⚛️ Framework Ready - React hooks, Vue composables, Angular services
  • 📦 Zero Dependencies - Lightweight and self-contained
  • 🌐 Universal - Works in browser and Node.js
  • 🎨 TypeScript - Full type definitions included

📦 Installation

npm install purify-voice

Or with yarn:

yarn add purify-voice

🚀 Quick Start

Vanilla JavaScript

import { Purify } from 'purify-voice';

// Initialize
const purify = new Purify();
await purify.initialize();

// Process audio file
const audioFile = document.querySelector('input[type="file"]').files[0];
const denoisedBlob = await purify.processFile(audioFile);

// Play or download the result
const audio = new Audio(URL.createObjectURL(denoisedBlob));
audio.play();

React

import { usePurify } from 'purify-voice/react';

function AudioDenoiser() {
  const { isReady, processFile, isProcessing } = usePurify();
  const [result, setResult] = useState(null);

  const handleFile = async (e) => {
    const file = e.target.files[0];
    const denoised = await processFile(file);
    setResult(URL.createObjectURL(denoised));
  };

  return (
    <div>
      <input type="file" accept="audio/*" onChange={handleFile} disabled={!isReady} />
      {isProcessing && <p>Processing...</p>}
      {result && <audio src={result} controls />}
    </div>
  );
}

Vue 3

<template>
  <div>
    <input type="file" accept="audio/*" @change="handleFile" :disabled="!isReady" />
    <p v-if="isProcessing">Processing...</p>
    <audio v-if="result" :src="result" controls />
  </div>
</template>

<script setup>
import { ref } from 'vue';
import { usePurify } from 'purify-voice/vue';

const { isReady, processFile, isProcessing } = usePurify();
const result = ref(null);

const handleFile = async (e) => {
  const file = e.target.files[0];
  const denoised = await processFile(file);
  result.value = URL.createObjectURL(denoised);
};
</script>

Angular

import { Component } from '@angular/core';
import { PurifyService } from 'purify-voice/angular';

@Component({
  selector: 'app-audio-denoiser',
  template: `
    <input type="file" accept="audio/*" (change)="handleFile($event)" 
           [disabled]="!(purifyService.isReady$ | async)" />
    <p *ngIf="purifyService.isProcessing$ | async">Processing...</p>
    <audio *ngIf="result" [src]="result" controls></audio>
  `
})
export class AudioDenoiserComponent {
  result: string | null = null;

  constructor(public purifyService: PurifyService) {}

  async handleFile(e: Event) {
    const file = (e.target as HTMLInputElement).files?.[0];
    if (!file) return;
    
    this.purifyService.processFile(file).subscribe(denoised => {
      this.result = URL.createObjectURL(denoised);
    });
  }
}

Node.js

const { Purify } = require('purify-voice');
const fs = require('fs');

async function denoise() {
  const purify = new Purify();
  await purify.initialize();

  // Read audio file
  const audioBuffer = fs.readFileSync('input.wav');
  const blob = new Blob([audioBuffer]);

  // Process
  const denoised = await purify.processFile(blob);

  // Save result
  const buffer = Buffer.from(await denoised.arrayBuffer());
  fs.writeFileSync('output.wav', buffer);
}

denoise();

📖 API Reference

Purify

Main class for audio denoising.

Constructor

new Purify(options?: PurifyOptions)

Options:

  • sampleRate?: number - Sample rate (default: 48000)
  • frameSize?: number - Frame size in samples (default: 480)
  • wasmPath?: string - Custom WASM file path

Methods

initialize(): Promise<void>

Initialize the Purify instance. Must be called before processing.

processFile(audioFile: File | Blob): Promise<Blob>

Process an audio file and return denoised audio as a Blob.

processBuffer(audioBuffer: AudioBuffer): Promise<AudioBuffer>

Process an AudioBuffer and return denoised AudioBuffer.

processStream(inputStream: MediaStream): Promise<MediaStream>

Process a real-time audio stream (e.g., from microphone).

processRaw(pcmData: Float32Array): Promise<Float32Array>

Process raw PCM data.

isReady(): boolean

Check if Purify is initialized and ready.

destroy(): void

Clean up resources.

React Hook: usePurify

const {
  isReady,      // boolean - Is Purify initialized?
  isProcessing, // boolean - Is currently processing?
  error,        // Error | null - Last error
  processFile,  // (file: File) => Promise<Blob | null>
  processBuffer,// (buffer: AudioBuffer) => Promise<AudioBuffer | null>
  processStream // (stream: MediaStream) => Promise<MediaStream | null>
} = usePurify(options?);

Vue Composable: usePurify

const {
  isReady,      // Ref<boolean>
  isProcessing, // Ref<boolean>
  error,        // Ref<Error | null>
  processFile,  // (file: File) => Promise<Blob | null>
  processBuffer,// (buffer: AudioBuffer) => Promise<AudioBuffer | null>
  processStream // (stream: MediaStream) => Promise<MediaStream | null>
} = usePurify(options?);

🎯 Use Cases

  • Voice Calls - Remove background noise from video/audio calls
  • Podcasts - Clean up podcast recordings
  • Voice Notes - Enhance voice message quality
  • Transcription - Improve speech-to-text accuracy
  • Music Production - Remove unwanted noise from recordings

🌐 Browser Compatibility

  • Chrome/Edge 90+
  • Firefox 88+
  • Safari 14+
  • Node.js 14+

📊 Performance

  • Processing Speed: ~100x real-time (10ms audio processed in ~0.1ms)
  • Latency: <10ms for real-time processing
  • Memory: ~5MB WASM module + processing buffers
  • Package Size: ~200-500KB (gzipped)

🛠️ Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Watch mode
npm run dev

📝 License

MIT © Sagar

🙏 Credits

  • Built on RNNoise by Jean-Marc Valin
  • Powered by WebAssembly

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📮 Support


Made with ❤️ by Sagar