@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.
@@ -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 += sampleStep) {
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. The drawer resamples these to fit
693
- // canvasWidth / (barWidth + barSpacing) bars, so this is fidelity headroom,
694
- // not the visible bar count.
695
- samples: 256,
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