
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
goertzel-node
Advanced tools
The Goertzel algorithm is a Digital Signal Processing (DSP) technique that provides a means for efficient evaluation of individual terms of the Discrete Fourier Transform (DFT),
This package implement a WebAudio node which detects if a specified frequency is present in the audio stream using the goertzel algorithm.
detected.GoertzelNode uses the ScriptProcessorNode and performs the Goertzel algorithm on every chunk of data that comes through the ScriptProcessorNode. The calculations are performed on a chunk by chunk bases and the outputs (power, and detected) are updated on every chunk as well.
The package exposes a node.js style API, and is designed to be used tools such as browserify.
A standalone browserified file is also available here, which creates a global named GoertzelNode when included in the html.
npm install goertzel-node
var GoertzelNode = require('goertzel-node'); // only if using browserify.
var audioContext = new AudioContext();
var osc = audioContext.createOscillator();
var gn = new GoertzelNode(audioContext);
gn.targetFrequency = 440; // 440Hz
osc.connect(gn);
gn.connect(audioContext.destination);
osc.start(0);
var result = gn.detected; //boolean true/false
GoertzelNode : Creates a new GoertzelNode.
var gn = new GoertzelNode(audioContext);
audioContext : AudioContext - The AudioContext within which the GoertzelNode is to be created.connect : Connects the GoertzelNode to other WebAudio Nodes. This is exactly the same as the connect method of ScriptProcessorNode.disconnect : Disconnects the GoertzelNode from other WebAudio Nodes. This is exactly the same as the disconnect method of ScriptProcessorNode.targetFrequency: Number - The value of the frequency (in Hertz) that is to be detected by the GoertzelNode. It defaults to 440.
eg:
gn.targetFrequency = 440; // Set the frequency to be detected to be 440.
targetFrequency can be set at any time. Once set, the GoertzelNode will start calculating and outputting the values for that frequency at every chunk.passthrough: Boolean - Boolean value defining if the Node passes the audio through to the destination or not. Default value is true.
eg:
osc.connect(gn);
gn.connect(context.destination);
gn.passthrough = false; // Ensures that audio from the oscillator doesn't get played out.
channel: Number - The channel of the input audio stream to be used for analysis. The default value is 1.
eg:
gn.channel = 1; // Set the channel of the input audio stream to be analyzed.
power: Number - Returns the power of the audio of the input audio stream at the targetFrequency. This value is normalised to chunkSize and should be a maximum of 0.25 for a perfect match.
eg:
var power = gn.power; // Get the power.
targetFrequency.threshold: Number - Sets a threshold of power used to decide if the targetFrequency was detected.
eg:
gn.threshold = 0.22; // Set the threshold to 0.22.
power power is higher than threshold then detected is set as true.detected: Boolean - Returns if the targetFrequency was detected in the input audio stream.
eg:
var detected = gn.detected; // If the frequency was detected in the input audio stream.
MIT
See License file
FAQs
WebAudio Node that implements a goertzel filter
We found that goertzel-node demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.