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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ennuicastr/webrtcaec3.js

v0.3.0

Published

Port of WebRTC's AEC3 (acoustic echo canceller, version 3) library to WebAssembly/JavaScript

Downloads

13

Readme

This is a port of WebRTC's AEC3 (acoustic echo cancellation... 3) library to WebAssembly and JavaScript, so that echo cancellation can be performed on any audio, rather than trusting whatever echo cancellation getUserMedia wishes to do.

The Google WebRTC implementation from which this is derived is under a 3-clause BSD license, and so a compiled version of this library falls under the same license. The small amount of glue code provided by this library itself is under the so-called “0-clause BSD license” and does not require attribution. Additionally, library components used by WebRTC are under the Apache 2 license.

API

Include webrtcaec3.js, or import or require this library as a module. Once the library is loaded, WebRtcAec3 is a function which returns a promise for a WebRtcAec3 module instance. With a WebRtcAec3 module instance AEC3, AEC3.AEC3 is a constructor for an AEC3 instance, taking three parameters: the sample rate, and the number of channels for the render (output) and capture (input) streams, respectively. The AEC3 library itself is synchronous, so if you need asynchrony, use it in a WebWorker.

Putting that together:

const AEC3 = await WebRtcAec3();
const aec = new AEC3(sampleRate, outputChannels, inputChannels);

Note that not all sample rates will work. In fact, most won't. Basically, use 48000.

The AEC3 instances expose three methods: analyze, processSize, and process. Use analyze to analyze render (output) data:

aec.analyze(outputData /* Float32Array[] */);

Use process to process capture (input) data, cancelling echo. It deposits the processed data into an output buffer which you must provide. You can use processSize to get the necessary size of each channel of the output buffer.

const bufSz = aec.processSize(inputData);
const outBuf = [new Float32Array(bufSz)]; // one per channel
aec.process(outBuf, inputData /* Float32Array[] */);
... do something with outBuf ...

analyze, processSize, and process each take an optional “options” argument, which in particular can take a sample rate for the input data. If the sample rate for the input data does not match the sample rate with which the AEC3 instance was created, it will be resampled.

For further documentation on each method, see the types file.