You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bundle wrapper is doing something wrong. hark.bundle.js is broken. Take a look at the source and you immediately see that getMaxVolume() is not being called anywhere else in the source. I went back to the unbundled version and modernized the variable scope prefixes while I was at it, and it works now. Note: My version is formatted to be used as a module and I am importing wildemitted.js from a a sibling events directory, also as a module.
Here is my "unbundled" version. Tested and it works fine:
// Import dependencies (ensure WildEmitter is available as an ES6 module)importWildEmitterfrom'../events/wildemitter.mjs';exportfunctiongetMaxVolume(analyser,fftBins){letmaxVolume=-Infinity;analyser.getFloatFrequencyData(fftBins);for(leti=4,ii=fftBins.length;i<ii;i++){if(fftBins[i]>maxVolume&&fftBins[i]<0){maxVolume=fftBins[i];}}returnmaxVolume;}letaudioContextType;if(typeofwindow!=='undefined'){audioContextType=window.AudioContext||window.webkitAudioContext;}letaudioContext=null;exportfunctionhark(stream,options){letharker=newWildEmitter();// Ensure WildEmitter is correctly imported or implementedif(!audioContextType)returnharker;options=options||{};letsmoothing=options.smoothing||0.1,interval=options.interval||50,threshold=options.threshold,play=options.play,history=options.history||10;audioContext=options.audioContext||audioContext||newaudioContextType();letanalyser=audioContext.createAnalyser();analyser.fftSize=512;analyser.smoothingTimeConstant=smoothing;letfftBins=newFloat32Array(analyser.frequencyBinCount);letsourceNode;if(stream.jquery)stream=stream[0];if(streaminstanceofHTMLAudioElement||streaminstanceofHTMLVideoElement){sourceNode=audioContext.createMediaElementSource(stream);if(typeofplay==='undefined')play=true;threshold=threshold||-50;}else{sourceNode=audioContext.createMediaStreamSource(stream);threshold=threshold||-50;}sourceNode.connect(analyser);if(play)analyser.connect(audioContext.destination);// Implement harker logic...returnharker;}
The text was updated successfully, but these errors were encountered:
The bundle wrapper is doing something wrong. hark.bundle.js is broken. Take a look at the source and you immediately see that
getMaxVolume()
is not being called anywhere else in the source. I went back to the unbundled version and modernized the variable scope prefixes while I was at it, and it works now. Note: My version is formatted to be used as amodule
and I am importingwildemitted.js
from a a siblingevents
directory, also as a module.Here is my "unbundled" version. Tested and it works fine:
The text was updated successfully, but these errors were encountered: