Socket
Socket
Sign inDemoInstall

a-weighting

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    a-weighting

A/B/C/D/Z-weighting for audio


Version published
Maintainers
1
Install size
5.76 kB
Created

Readme

Source

a-weighting Build Status unstable Greenkeeper badge

Perform A-weighting (and others) for a frequency. Useful for creating believable spectrum images and audio measurements.

A-weighting

Usage

npm install a-weighting

var aWeight = require('a-weighting/a');
var ft = require('fourier-transform');

//get a-weighted frequencies
var frequencies = ft(waveform).map(function (magnitude, i, data) {
	var frequency = 22050 * i / data;

	return aWeight(frequency) * magnitude;
});

Note that weight function returns normalized 0..1 weight values, it does not do decibels calculation. If you need to convert weight to decibels, do 20 * Math.log(weight) / Math.log(10).

Implemented weights:

  • A-weighting
  • B-weighting
  • C-weighting
  • D-weighting
  • Z-weighting (zero weighting)
  • M-weighting

Credits

Thanks to all the specialists who researched and described these curves (years of work I guess) and wikipedia for detailed articles on this.

Keywords

FAQs

Last updated on 30 Apr 2017

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