@arraypress/waveform-player 1.14.0 → 1.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/waveform-player.cjs +7 -6
- package/dist/waveform-player.cjs.map +2 -2
- package/dist/waveform-player.esm.js +2 -2
- package/dist/waveform-player.esm.js.map +3 -3
- package/dist/waveform-player.js +7 -6
- package/dist/waveform-player.min.js +2 -2
- package/dist/waveform-player.min.js.map +3 -3
- package/index.d.ts +2 -1
- package/package.json +1 -1
- package/src/js/audio.js +12 -7
- package/src/js/themes.js +6 -4
package/dist/waveform-player.cjs
CHANGED
|
@@ -568,7 +568,6 @@ function detectOnsets(channelData, sampleRate) {
|
|
|
568
568
|
// src/js/audio.js
|
|
569
569
|
function extractPeaks(buffer, samples = 200) {
|
|
570
570
|
const sampleSize = buffer.length / samples;
|
|
571
|
-
const sampleStep = ~~(sampleSize / 10) || 1;
|
|
572
571
|
const channels = buffer.numberOfChannels;
|
|
573
572
|
const peaks = [];
|
|
574
573
|
for (let c = 0; c < channels; c++) {
|
|
@@ -578,7 +577,7 @@ function extractPeaks(buffer, samples = 200) {
|
|
|
578
577
|
const end = ~~(start + sampleSize);
|
|
579
578
|
let min = 0;
|
|
580
579
|
let max = 0;
|
|
581
|
-
for (let j = start; j < end; j
|
|
580
|
+
for (let j = start; j < end; j++) {
|
|
582
581
|
const value = chan[j];
|
|
583
582
|
if (value > max) max = value;
|
|
584
583
|
if (value < min) min = value;
|
|
@@ -689,10 +688,12 @@ var DEFAULT_OPTIONS = {
|
|
|
689
688
|
// Core settings
|
|
690
689
|
url: "",
|
|
691
690
|
height: 64,
|
|
692
|
-
// Source peak resolution
|
|
693
|
-
// canvasWidth / (barWidth + barSpacing)
|
|
694
|
-
// not the visible bar count.
|
|
695
|
-
|
|
691
|
+
// Source peak resolution for LIVE decode (ignored when peaks are supplied).
|
|
692
|
+
// The drawer resamples these to fit canvasWidth / (barWidth + barSpacing)
|
|
693
|
+
// bars, so this is fidelity headroom, not the visible bar count. 1800 (the
|
|
694
|
+
// SoundCloud/WaveformGen figure) keeps wide / high-DPI waveforms crisp; the
|
|
695
|
+
// every-frame scan means a higher value costs no extra extraction time.
|
|
696
|
+
samples: 1800,
|
|
696
697
|
preload: "metadata",
|
|
697
698
|
// Audio mode — 'self' = player owns the <audio> element (default, current
|
|
698
699
|
// behavior). 'external' = player is a visualization-only surface; no audio
|