How to use the meyda.bufferSize 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 wavesjs / waves-lfo / benchmarks / lib / src / benchRms.js View on Github external
frameType: 'signal',
        sourceSampleRate: sampleRate,
      });

      suite.add(`lfo:rms\t\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = rms.inputSignal(frame);
          }
        },
      });

      Meyda.bufferSize = frameSize;
      Meyda.sampleRate = sampleRate;
      // #todo - windowing function should be 'rect' to skip windowing...
      // https://github.com/meyda/meyda/blob/master/src/utilities.js#L27

      suite.add(`meyda:rms\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = Meyda.extract('rms', frame);
          }
        },
      });

      suite.on('cycle', function(event) {
github wavesjs / waves-lfo / benchmarks / lib / src / benchMfcc.js View on Github external
frameType: 'signal',
        sourceSampleRate: sampleRate,
      });

      suite.add(`lfo:mfcc\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = mfcc.inputSignal(frame);
          }
        },
      });

      Meyda.bufferSize = frameSize;
      Meyda.sampleRate = sampleRate;

      suite.add(`meyda:mfcc\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = Meyda.extract('mfcc', frame);
          }
        },
      });

      suite.on('cycle', function(event) {
        log.push(String(event.target));
      });
github miselaytes-anton / web-audio-experiments / packages / voice-shape-app / src / audio.js View on Github external
export const extractFeatures = (signal, sampleRate) => {
  const frames = signalToFrames(signal, sampleRate, {});

  Meyda.bufferSize = 512;
  const mfcc = frames
    .map(frame => Meyda.extract('mfcc', frame));

  Meyda.bufferSize = 2048;
  const f0 = frames
      .map(frame => Meyda.extract('amplitudeSpectrum', frame))
      .map(binsPerFrame => getF0(binsPerFrame, sampleRate, humanVoiceRange));
  return {mfcc: vAvg(mfcc), f0: avg(f0)};
};
github wavesjs / waves-lfo / benchmarks / lib / src / benchFft.js View on Github external
frameType: 'signal',
        sourceSampleRate: sampleRate,
      });

      suite.add(`lfo:fft\t\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = fft.inputSignal(frame);
          }
        },
      });

      Meyda.bufferSize = frameSize;
      Meyda.sampleRate = sampleRate;

      suite.add(`meyda:fft\tframeSize: ${frameSize}\t`, {
        fn: function() {
          for (let i = 0; i < numFrames; i++) {
            const start = i * frameSize;
            const end = start + frameSize;
            const frame = buffer.subarray(start, end);
            const res = Meyda.extract('amplitudeSpectrum', frame);
          }
        },
      });

      suite.on('cycle', function(event) {
        log.push(String(event.target));
      });
github miselaytes-anton / web-audio-experiments / packages / visualizer-app / src / index.js View on Github external
analyser.getAudioFeatures = () => {
    analyser.getByteFrequencyData(freqDataArray);
    analyser.getFloatTimeDomainData(timeDataFloatArray);
    const frequencyData = Array.from(freqDataArray);
    Meyda.fftSize = fftSize;
    Meyda.bufferSize = fftSize;
    const {mfcc, spectralCentroid, rms, loudness} = Meyda.extract([
        'mfcc',
        'spectralCentroid',
        'rms',
        'loudness',
      ],
      timeDataFloatArray
    );
    return {frequencyData, rms, mfcc, spectralCentroid, loudness: loudness.total};
  };
  return analyser;

meyda

Real-time feature extraction for the web audio api

MIT
Latest version published 7 months ago

Package Health Score

65 / 100
Full package analysis