Question

I want to create and audio visualisation for audio on canvas and decided to use SoundManager2. The problem is function that should return waveformdata throws out empty arrays. Any idea what to do? (I hear the sound playing so it is loaded correct:) )

    <script>
    (function() {

     soundManager.url = 'swf/';
     soundManager.flashVersion = 9;

      soundManager.onready(function() {

       var i = 0;

var song = soundManager.createSound({
  id: 'song',
  url: 'https://www.mash-up.pl/sites/default/files/mp3/HF028A.mp3'
});

console.log(soundManager.features.waveformData); // true

function draw() {

  // emit waveform data every once in a while as to not break console
  if (!(i % 200)) {
    // wth these are empty
    console.log(song.waveformData.left);
    console.log(song.waveformData.right);
  }

  i++;
  window.webkitRequestAnimationFrame(draw);

}

draw();

song.play();

     });

   })();

Was it helpful?

Solution

ok have found that soundobject has useWaveformData set to false (found it after debugging in console).

question can be closed :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top