How to use waveform-data - 4 common examples

To help you get started, we’ve selected a few waveform-data examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github compactd / compactd / client / src / features / player / components / PlayerAudio / PlayerAudio.tsx View on Github external
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]);
github joshwcomeau / beatmapper / src / middlewares / song.middleware.helpers.js View on Github external
return new Promise((resolve, reject) => {
    webAudioBuilder(audioContext, arrayBuffer, (err, waveform) => {
      if (err) {
        reject(err);
      }

      resolve(waveform);
    });
  });
};
github joshwcomeau / beatmapper / src / helpers / audio.helpers.js View on Github external
.then(buffer => {
        webAudioBuilder(audioContext, buffer, (err, waveform) => {
          if (err) {
            reject(err);
          }

          resolve(waveform);
        });
      });
  });

waveform-data

Audio Waveform Data Manipulation API – resample, offset and segment waveform data in JavaScript

LGPL-3.0
Latest version published 11 months ago

Package Health Score

67 / 100
Full package analysis

Popular waveform-data functions