0
使用Web音频API时,我想将音频保存在缓冲区中供以后使用。我发现了一些将音频保存到磁盘的例子,但我只想将它存储在内存中。我尝试将链中最后一个AudioNode的输出连接到AudioBuffer,但似乎AudioBuffer没有接受输入的方法。将音频保存在缓冲区中供以后播放
var contextClass = (window.AudioContext || window.webkitAudioContext);
// Output compressor
var compressor = context.createDynamicsCompressor();
var compressor.connect(context.destination);
var music = context.createBufferSource();
// Load some content into music with XMLHttpRequest...
music.connect(compressor);
music.start(0);
// Set up recording buffer
var recordBuffer = context.createBuffer(2, 10000, 44100);
compressor.connect(recordBuffer);
// Failed to execute 'connect' on 'AudioNode': No function was found that matched the signature provided.
有什么我可以用来代替AudioBuffer来实现这个吗?有没有办法做到这一点,而不保存文件到磁盘?