Experiments

  • Heart
  • Unamed Analyzer
  • Mage of Life

I'm quite pleased with the this. The algorithm is entwined with the audio and isn't very verstaile, for now.

The looping is atrocious. I haven't found a workaround yet. I have to find a solution for this, either by finding a library that loops seamlessly while letting me access the audio element, or ... WIP. eww

The audio won't load locally because Chrome because of CORS. shrug

analyser.getByteFrequencyData(frequencyData);

intensity = 0;

frequencyData.forEach( function (value) { intensity += value;});
intensity /= resolution;

intensities.push(intensity);
if (intensities.length > sampleSize) {
	intensities.shift();
}

averageIntensity = 0;
intensities.forEach( function (e, i) {
	averageIntensity += e;
});
averageIntensity /= intensities.length;

ratio = intensity / averageIntensity;
if (ratio >= sensibility) {
	Crafty("Heart").trigger("Beat");
}
This site is not functional. It is effectively a placeholder. grimskunk -> gmail <- com