AudioContext CreateBuffer() 中的大文件问题
Issue with large file in AudioContext CreateBuffer()
我想创建一个具有 1 个通道、1190256000 长度和 48000 个样本的音频缓冲区 rate.but 我在 createBuffer() 中遇到错误 methode.please 找到包含样本的 fiddle .
如果长度为 1,190,256,000,您很可能 运行 进入浏览器的缓冲区大小限制。如果您查看 name
属性,您将看到您正在尝试的操作导致 NotSupportedError(在 chrome 中,在其他浏览器中可能有所不同)。
NotSupportedError
One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than supported,
or a sampleRate outside the nominal range).
就好像你尝试了一个较低的值你就成功了
window.AudioContext = window.AudioContext || window.webkitAudioContext;
audioContext = new window.AudioContext();
var buffer;
try {
audioContext.createBuffer(1, 1190256000, 48000);
} catch(e){
console.log(e.name,e.message);
}
try {
buffer = audioContext.createBuffer(1, 119025600, 48000);
console.log("success",buffer);
} catch (e) {
console.log(e.name,e.message);
}
我想创建一个具有 1 个通道、1190256000 长度和 48000 个样本的音频缓冲区 rate.but 我在 createBuffer() 中遇到错误 methode.please 找到包含样本的 fiddle .
如果长度为 1,190,256,000,您很可能 运行 进入浏览器的缓冲区大小限制。如果您查看 name
属性,您将看到您正在尝试的操作导致 NotSupportedError(在 chrome 中,在其他浏览器中可能有所不同)。
NotSupportedError
One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than supported, or a sampleRate outside the nominal range).
就好像你尝试了一个较低的值你就成功了
window.AudioContext = window.AudioContext || window.webkitAudioContext;
audioContext = new window.AudioContext();
var buffer;
try {
audioContext.createBuffer(1, 1190256000, 48000);
} catch(e){
console.log(e.name,e.message);
}
try {
buffer = audioContext.createBuffer(1, 119025600, 48000);
console.log("success",buffer);
} catch (e) {
console.log(e.name,e.message);
}