У меня есть скрипт, который получает звуковые частоты. Я хочу связать эту частоту с точным временем песни. Я могу получить свойство webkitAudioContext currentTime, но это не так, потому что оно начинает отсчитывать время, когда вы сохраняете звук в буфере перед началом записи. Это мой код:Веб-аудио Api: частота, связанная с истекшим временем
var context = new webkitAudioContext();
...
function drawSpectrogram(array) {
// copy the current canvas onto the temp canvas
var canvas = document.getElementById("canvas");
tempCtx.drawImage(canvas, 0, 0, 800, 512);
// iterate over the elements from the array
for (var i = 0; i < array.length; i++) {
// draw each pixel with the specific color
var value = array[i];
frequency = frequency + value + ";";
time = time + Math.round((context.currentTime) * 1000000)/1000000 + ";";
ctx.fillStyle = hot.getColor(value).hex();
// draw the line at the right side of the canvas
ctx.fillRect(800 - 1, 512 - i, 1, 1);
}
}
Спасибо!