Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return;
}
const transition = d3.transition().duration(500).ease();
const svg = d3.select(svge);
const x = d3.scaleLinear()
const y = d3.scaleLinear();
const {width} = this.svg.parentElement.getBoundingClientRect();
this.svg.setAttribute("width", `${width}`);
const {height} = this.svg.getBoundingClientRect();
const gap = 1;
const relativeGap = gap / width;
if (!wf) {
svg.selectAll('*').remove();
return;
}
const data = wf? WaveformData.create(wf).resample({width: width / 3}) : null;
const samples = data? data.adapter.length : width / 3;
const barWidth = width / samples - gap;
const middleGap = 1
const topHeight = height * 2/3;
const botHeight = height * 1/3 - middleGap;
const ANIMATION_LENGTH = 250;
const ANIMATION_DURATION = 250;
const delayPerBar = ANIMATION_LENGTH / samples;
x.domain([0, samples]);
const max = d3.max(data.max);
y.domain([-max / 50, max]);
return new Promise((resolve, reject) => {
webAudioBuilder(audioContext, arrayBuffer, (err, waveform) => {
if (err) {
reject(err);
}
resolve(waveform);
});
});
};
.then(buffer => {
webAudioBuilder(audioContext, buffer, (err, waveform) => {
if (err) {
reject(err);
}
resolve(waveform);
});
});
});