Open rob-richards opened 1 year ago
I am not getting any returned frames that contain a gap in the audio using GapsDetector. I am using Node for offline extraction. Am I missing something?
GapsDetector
I know for sure that the audio file has gaps. I added 3 of them manually in my DAW.
const esLib = require('essentia.js'); const wav = require('node-wav'); const fs = require('fs'); const frameSize = 2048; const hopSize = 1024; async function detectGapsInAudio(audioFilename) { try { const essentia = new esLib.Essentia(esLib.EssentiaWASM); const buffer = fs.readFileSync(audioFilename); const audio = wav.decode(buffer); const audioDataLeft = essentia.arrayToVector(audio.channelData[0]); const audioDataRight = essentia.arrayToVector(audio.channelData[1]); const audioDownMixed = essentia.MonoMixer( audioDataLeft, audioDataRight ).audio; const audioData = essentia.vectorToArray(audioDownMixed); const frames = essentia.FrameGenerator(audioData, frameSize, hopSize); const gaps = []; for (let i = 0; i < frames.size(); i++) { // Detect gaps for each frame of downmixed audio signal const gapsDetector = essentia.GapsDetector( frames.get(i), 0.05, // attackTime frameSize, // frameSize hopSize, // hopSize 11, // kernelSize 3500, // maximumTime 10, // minimumTime 40, // postpowerTime -30, // prepowerThreshold 20, // prepowerTime 0.05, // releaseTime 44100, // sampleRate -50 // silenceThreshold ); if (gapsDetector.starts.size() !== 0) { gaps.push(gapsDetector); } } console.log('gaps :>> ', gaps); frames.delete(); essentia.delete(); } catch (error) { console.error('Catch Block Error: >> ', error); } } const audioFilename = 'audio-file.wav'; detectGapsInAudio(audioFilename);
MacBook Pro M2 Max, Node.js v18.16.0
What is the issue about?
What part(s) of Essentia.js is involved?
Description
I am not getting any returned frames that contain a gap in the audio using
GapsDetector
. I am using Node for offline extraction. Am I missing something?I know for sure that the audio file has gaps. I added 3 of them manually in my DAW.
Steps to reproduce / Code snippets / Screenshots
System info
MacBook Pro M2 Max, Node.js v18.16.0