
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
Simple package on pure JavaScript with Audio Web API usage that was made for purpose of calculation sound frequency from microphone
Simple package on pure JavaScript with Audio Web API usage that was made for purpose of calculating sound frequency from microphone.
Has been tested only in desktop and mobile Google Chrome version 87.0. Package doesn't include polyfills. Stable work in other browsers isn't guaranteed. Requires support of Web Audio API. Has 0 dependencies from other packages.
import { freelizer } from 'freelizer'
;(async function () {
try {
const { start, subscribe } = await freelizer()
start()
subscribe(console.log)
} catch (error) {
// Error handling goes here
}
})()
Import freelizer function
import { freelizer } from 'freelizer'
Call freelizer function. Beware, that freelizer is asynchronous. It returns an object that contains functions. Call of freelizer asks for permission of using microphone.
const { start, subscribe } = await freelizer()
Use start() function to launch process of sound listening.
start()
Use subscribe() function that takes callback-function as argument. Callback-function will get data object as parameter. Callback will be called on each animation frame.
subscribe(console.log)
Example of console output:
{
frequency: 163.71831025615992,
note: "E",
noteFrequency: 164.81377845643485,
octave: 3,
deviation: -1.0954682002749223,
}
freelizerAsynchronous function that call returns an object that contains functions for library mainpulation. These functions are:
start()stop()subscribe()unsubscribe()const { start, stop, subscribe, unsubscribe } = await freelizer()
Since the function is asynchronous it recommended to use try/catch statement.
The most frequent cause of errors is situation when user blocks microphone usage.
try {
const { start, subscribe } = await freelizer()
} catch (error) {
// Error handling goes here
}
startFunction that launch process of sound listening. During this process all functions-subscribers are called on each animation frame.
stopThe opposite of start function. It stops process of sound listening.
subscribeProvides mechanism of subscription to sound listening stream. It takes callback-function as argument. Callback-function will get data object as parameter. Callback will be called on each animation frame.
const callbackExample = data => console.log(data)
subscribe(callbackExample)
Callback-function takes object that contains the following fileds:
Float NumberStringFloat NumberInteger NumberFloat Number{
frequency: 163.71831025615992,
note: "E",
noteFrequency: 164.81377845643485,
octave: 3,
deviation: -1.0954682002749223,
}
Its possible to subscribe as many functions as needed.
unsubscribeUnsubscribes callback-function from listening of stream.
Takes callback-function that previously was transmitted to subscribe function.
Remember that it doesn't work with annonymous functions.
Example that logs data in console for 5 seconds:
const { start, stop, subscribe, unsubscribe } = await freelizer()
start()
const callbackExample = (data) => console.log(data)
subscribe(callbackExample)
setTimeout(() => unsubscribe(callbackExample), 5000)
Original algorithm that returns frequency value from waveform was taken from "Simple pitch detection" repository.
FAQs
Simple package on pure JavaScript with Audio Web API usage that was made for purpose of calculation sound frequency from microphone
We found that freelizer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.