Socket
Socket
Sign inDemoInstall

@sapphi-red/web-noise-suppressor

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @sapphi-red/web-noise-suppressor

Noise suppressor nodes for Web Audio API.


Version published
Maintainers
1
Install size
656 kB
Created

Readme

Source

@sapphi-red/web-noise-suppressor

npm version CI

Noise suppressor nodes for Web Audio API.

Demo

This package provides three noise suppression nodes.

  • NoiseGateWorkletNode: A simple noise gate implementation
  • RnnoiseWorkletNode: Based on xiph/rnnoise
  • SpeexWorkletNode: Based on xiph/speexdsp's preprocess function

This package requires AudioWorklet to work.

Install

npm i @sapphi-red/web-noise-suppressor # yarn add @sapphi-red/web-noise-suppressor

Usage

This section is written only for vite users.

import { SpeexWorkletNode } from '@sapphi-red/web-noise-suppressor'
import speexWorkletPath from '@sapphi-red/web-noise-suppressor/speexWorklet.js?url'
import speexWasmPath from '@sapphi-red/web-noise-suppressor/speex.wasm?url' // you can use `vite-plugin-static-copy` instead of this

const ctx = new AudioContext()

const speexWasmBinary = await loadSpeex({ url: speexWasmPath })
await ctx.audioWorklet.addModule(speexWorkletPath)

const stream = await navigator.mediaDevices.getUserMedia({
  audio: true
})

const source = ctx.createMediaStreamSource(stream)
const speex = new SpeexWorkletNode(ctx, {
  wasmBinary: speexWasmBinary,
  maxChannels: 2
})

source.connect(speex)
speex.connect(ctx.destination)

For more details, see demo source code.

FAQs

Last updated on 25 Mar 2024

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc