使用Web Audio 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来实现这个目的吗?有没有办法在不将文件保存到磁盘的情况下执行此操作?