How to use the meyda.windowing function in meyda

To help you get started, we’ve selected a few meyda 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 vcync / modV / src / modv / sample-modules / Waveform.js View on Github external
draw({ canvas, context, features }) {
    const { width, height } = canvas;
    const bufferLength = features.buffer.length;
    const buffer = Meyda.windowing(features.buffer, this.windowing);

    context.lineWidth = this.strokeWeight;
    context.strokeStyle = this.colour;
    context.beginPath();

    const sliceWidth = width / bufferLength;
    let x = 0;

    for (let i = 0; i < bufferLength; i += 1) {
      const v = (buffer[i] / 100) * this.maxHeight;
      const y = (height / 2) + ((height / 2) * v);

      if (i === 0) {
        context.moveTo(x, y);
      } else {
        context.lineTo(x, y);

meyda

Real-time feature extraction for the web audio api

MIT
Latest version published 11 days ago

Package Health Score

84 / 100
Full package analysis