Generate waveform from an audio file with a simple API in Node.js.
This library use electron to generate waveform files from an audio file.
Install the lib and add it as a dependency :
npm install @lesjoursfr/audio-waveform
Then put this in your code:
const { AudioAnalyzer } = require("@lesjoursfr/audio-waveform");
const audioAnalyzer = new AudioAnalyzer(file, options);
audioAnalyzer
.waveform()
.then(() => {
console.log("Waveform Generated Successfully!");
})
.catch((err) => {
console.error("Failed to generate Waveform because of ", err);
});file: The audio fileoptions: Optional options to use xvfb for the generation
Previously, the electron npm package would download the Electron binary from the repository's GitHub Releases in the package's postinstall script. With recent supply chain security attacks against the npm ecosystem with postinstall scripts as a common attack vector, Electron will now download itself dynamically the first time that its main bin script is run (e.g. via npx electron). With this change, you can now use Electron with the npm --ignore-scripts flag.
If you need to download the Electron binary on-demand, you can now call the install-electron script:
npx install-electronSee the release post for more details.