How to use meyda - 10 common examples

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 / benchRms.js View on Github external
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) {
        log.push(String(event.target));
github vcync / modV / src / modv / MediaStream / set-source.js View on Github external
// Create the audio input stream (audio)
    this.audioStream = this.audioContext.createMediaStreamSource(stream)

    // Connect the audio stream to the analyser (this is a passthru) (audio->(analyser))
    this.audioStream.connect(this.analyserNode)

    // Connect the audio stream to the gain node (audio->(analyser)->gain)
    this.audioStream.connect(this.gainNode)

    // Connect the gain node to the output (audio->(analyser)->gain->destination)
    this.gainNode.connect(this.audioContext.destination)

    // Set up Meyda
    // eslint-disable-next-line new-cap
    this.meyda = new Meyda.createMeydaAnalyzer({
      audioContext: this.audioContext,
      source: this.audioStream,
      bufferSize: 512,
      windowingFunction: 'rect'
    })

    // Tell the rest of the script we're all good.
    this.mediaSourcesInited = true

    resolve(ids)
  })
}
github vcync / modV / src / set-media-source.js View on Github external
this.gainNode.gain.value = 0;
	
	// Create the audio input stream (audio)
	this.audioStream = this.audioContext.createMediaStreamSource(stream);

	// Connect the audio stream to the analyser (this is a passthru) (audio->(analyser))
	this.audioStream.connect(this.analyserNode);
	
	// Connect the audio stream to the gain node (audio->(analyser)->gain)
	this.audioStream.connect(this.gainNode);
	
	// Connect the gain node to the output (audio->(analyser)->gain->destination)
	this.gainNode.connect(this.audioContext.destination);
	
	// Set up Meyda
	this.meyda = new Meyda.createMeydaAnalyzer({
		audioContext: this.audioContext,
		source: this.audioStream,
		bufferSize: 512,
		windowingFunction: 'rect'
	});
	
	// Tell the rest of the script we're all good.
	this.mediaSourcesInited = true;
}
github miselaytes-anton / web-audio-experiments / packages / voice-shape-app / src / features.js View on Github external
export const extract = signal => {
  const signalOfSize = Array.from(signal).slice(0, closestPowerOf2(signal.length));
  const features = Meyda.extract(['mfcc', 'spectralCentroid'], signalOfSize)
  console.log(features);
  return features;
};
github wavesjs / waves-lfo / benchmarks / lib / src / benchMfcc.js View on Github external
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);
          }
        },
      });
github miselaytes-anton / web-audio-experiments / packages / voice-shape-app / src / audio.js View on Github external
      .map(frame => Meyda.extract('amplitudeSpectrum', frame))
      .map(binsPerFrame => getF0(binsPerFrame, sampleRate, humanVoiceRange));
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;
github wavesjs / waves-lfo / benchmarks / lib / src / benchFft.js View on Github external
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);
          }
        },
      });

meyda

Real-time feature extraction for the web audio api

MIT
Latest version published 7 months ago

Package Health Score

67 / 100
Full package analysis