New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

complex-analyser-node

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

complex-analyser-node

WebAudio ComplexAnalyserNode (FFT for I/Q signal)

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

ComplexAnalyserNode

WebAudio ComplexAnalyserNode using AudioWorklet and WebAssembly.

Usage


import { ComplexAnalyserNode } from './complex-analyser-node.js';

const audioContext = new AudioContext();

// ComplexAnalyserNode
//   input count = 1
//     channel count = 2
//       ch1 = In-phase
//       ch2 = Quadrature
await ComplexAnalyserNode.addModule(audioContext);
const complexAnalyserNode = new ComplexAnalyserNode(audioContext, {
	fftSize: 4096
});

const stream = await navigator.mediaDevices.getUserMedia({
	audio: {
		channelCount: {ideal: 2, min: 2},
		/* required for 2ch input input */
		echoCancelation: false,
		noiseSuppression: false,
		audioGainControl: false,
	}
});
const mediaStreamSource = audioContext.createMediaStreamSource(stream);
mediaStreamSource.connect(complexAnalyserNode);

const gain = audioContext.createGain();
gain.gain.value = 0;
complexAnalyserNode.connect(gain);
await complexAnalyserNode.init();
gain.connect(audioContext.destination);

const I = new Float32Array(complexAnalyserNode.fftSize);
const Q = new Float32Array(complexAnalyserNode.fftSize);
const buffer = new Float32Array(this.complexAnalyserNode.fftSize);
const render = () => {
	complexAnalyserNode.getFloatTimeDomainData(I, 0);
	complexAnalyserNode.getFloatTimeDomainData(Q, 1);

	drawWaveForms([I, Q]);

	complexAnalyserNode.getFloatFrequencyData(buffer);
	drawSpectrum(buffer);

	requestAnimationFrame(render);
};

requestAnimationFrame(render);

Development

init

cargo install cargo-make
cargo make build

run demo (just run http-server on ./site)

npm run serve

FAQs

Package last updated on 12 Jul 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc