3

我想为画布上的音频创建音频可视化并决定使用 SoundManager2。问题是应该返回波形数据的函数会抛出空数组。知道该怎么做吗?(我听到声音播放,所以它加载正确:))

    <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();

     });

   })();

4

1 回答 1

1

好的,发现 soundobject 已将 useWaveformData 设置为 false(在控制台中调试后发现)。

问题可以关闭:)

于 2013-01-07T16:02:09.610 回答