graph_freq_anon = {
const canvasCtx = canvas.getContext('2d');
canvasCtx.clearRect(0, 0, canvas.width, canvas.height);
data
function draw() {
canvasCtx.fillStyle = 'rgb(110, 110, 110)';
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
const barWidth = (width / 88);
let posX = 0;
const max_fft_height = -80
canvasCtx.fillStyle = 'rgb(255, 110, 110)';
canvasCtx.fillRect(0, canvas.height - ((sensitivity + 90) / 250 * canvas.height * 3), canvas.width, 2)
const key_height = 80
for (let i = 1; i <= 88; i++) {
let f = (27.5*2**((i-1)/12))
let name = key_name(f)
let color = name && name.includes('#') ? 'black' : 'white'
canvasCtx.fillStyle = color == 'white' ? 'rgb(255, 255, 255)' : 'rgb(0, 0, 0)'
canvasCtx.fillRect((i-1) * barWidth, 0, barWidth, key_height)
canvasCtx.fillStyle = 'rgb(110, 110, 110)'
canvasCtx.fillRect((i-1) * barWidth, 0, 1, key_height)
}
for (let i = 0; i < analyser.frequencyBinCount; i++) {
let f = i * (context.sampleRate /2) / analyser.frequencyBinCount
let name = key_name(f)
let color = name && name.includes('#') ? 'black' : 'white'
const barHeight = (data[i] == 0 ? 0 : data[i] + 90) * 7;
if (!mutable peaks.includes(f)) {
canvasCtx.fillStyle = 'rgb(255, 0, 255)'
canvasCtx.fillRect(key_n(f) * barWidth, canvas.height-barHeight, barWidth, barHeight)
continue;
}
canvasCtx.fillStyle = 'rgb(255, 50, 50)';
canvasCtx.fillRect(key_n(f) * barWidth, canvas.height - barHeight, barWidth, barHeight);
canvasCtx.fillRect(key_n(f) * barWidth, 0, barWidth, key_height)
}
};
draw();
}