Skip to content
The Chat Archive
llama2-70b-steerlm-chat· Meta Arena Human Preference 55K

if (typeof(Meyda) === 'undefined') { console.log('Meyda could not be found!'); } else {…

  1. User

    if (typeof(Meyda) === 'undefined') { console.log('Meyda could not be found!'); } else { console.log('Meyda could be found! Proceed.'); analyzer = Meyda.createMeydaAnalyzer({ "audioContext": getAudioContext(), "source": mySound, "bufferSize": 512, "featureExtractors": ["rms", "zcr", "energy", "amplitudeSpectrum", "powerSpectrum", "spectralCentroid", "spectralFlatness", "spectralSlope", "spectralRolloff", "spectralSpread", "spectralSkewness", "spectralKurtosis", "spectralCrest", "chroma", "loudness", "perceptualSpread", "perceptualSharpness", "mfcc", "complexSpectrum", "buffer"], "callback": features => { console.log(features); circleSize = Math.pow(features.rms*50, 13); circleColour = features.zcr;

        }
    });
    

    } this is the meyda code

    class FeaturesAllocation { constructor() { this.rms; this.zcr; this.energy; this.amplitudeSpectrum = []; this.powerSpectrum = []; this.spectralCentroid; this.spectralFlatness; this.spectralSlope; this.spectralRolloff; this.spectralSpread; this.spectralSkewness; this.spectralKurtosis; this.spectralCrest; this.chroma = []; this.loudness = []; this.perceptualSpread; this.perceptualSharpness; this.mfcc = []; }

    getAmplitudeSpectrum() { return this.amplitudeSpectrum[Math.floor(Math.random() * this.amplitudeSpectrum.length)]; }

    getPowerSpectrum() { return this.powerSpectrum[Math.floor(Math.random() * this.powerSpectrum.length)]; }

    getChroma() { return this.chroma[Math.floor(Math.random() * this.chroma.length)]; }

    getLoudness() { return this.loudness[Math.floor(Math.random() * this.loudness.length)]; }

    getMfcc() { this.mfcc[Math.floor(Math.random() * this.mfcc.length)]; } }

    and this is the features allocation

    how do i combine both together such that the features from Meyda will be passed into this function?

  2. Assistant

    To combine the Meyda code with the FeaturesAllocation class, you can modify the callback function in the Meyda code to create a new instance of the FeaturesAllocation class and populate its properties with the features returned by the analyzer. Here's an example:

    class FeaturesAllocation { constructor() { this.rms; this.zcr; this.energy; this.amplitudeSpectrum = []; this.powerSpectrum = []; this.spectralCentroid; this.spectralFlatness; this.spectralSlope; this.spectralRolloff; this.spectralSpread; this.spectralSkewness; this.spectralKurtosis; this.spectralCrest; this.chroma = []; this.loudness = []; this.perceptualSpread; this.perceptualSharpness; this.mfcc = []; }

    getAmplitudeSpectrum() { return this.amplitudeSpectrum[Math.floor(Math.random() * this.amplitudeSpectrum.length)]; }

    getPowerSpectrum() { return this.powerSpectrum[Math.floor(Math.random() * this.powerSpectrum.length)]; }

    getChroma() { return this.chroma[Math.floor(Math.random() * this.chroma.length)]; }

    getLoudness() { return this.loudness[Math.floor(Math.random() * this.loudness.length)]; }

    getMfcc() { this.mfcc[Math.floor(Math.random() * this.mfcc.length)]; } }

    and this is the features allocation

    how do i combine both together such that the features from Meyda will be passed into this function?

    In the Meyda code, modify the callback function to create a new instance of the FeaturesAllocation class and populate its properties with the features returned by the analyzer:

    if (typeof(Meyda) === 'undefined') { console.log('Meyda could not be found!'); } else { console.log('Meyda could be found! Proceed.'); analyzer = Meyda.createMeydaAnalyzer({ "audioContext": getAudioContext(), "source": mySound, "bufferSize": 512, "featureExtractors": ["rms", "zcr", "energy", "amplitudeSpectrum", "powerSpectrum", "spectralCentroid", "spectralFlatness", "spectralSlope", "spectralRolloff", "spectralSpread", "spectralSkewness", "spectralKurtosis", "spectralCrest", "chroma", "loudness", "perceptualSpread", "perceptualSharpness", "mfcc", "complexSpectrum", "buffer"], "callback": features => { // Create a new instance of the FeaturesAllocation class const featuresAllocation = new FeaturesAllocation();

    // Populate the properties of the FeaturesAllocation instance with the features featuresAllocation.rms = features.rms; featuresAllocation.zcr = features.zcr; featuresAllocation.energy = features.energy; featuresAllocation.amplitudeSpectrum = features.amplitudeSpectrum; featuresAllocation.powerSpectrum = features.powerSpectrum; featuresAllocation.spectralCentroid = features.spectralCentroid; featuresAllocation.spectralFlatness = features.spectralFlatness; featuresAllocation.spectralSlope = features.spectralSlope; featuresAllocation.spectralRolloff = features.spectralRolloff; featuresAllocation.spectralSpread = features.spectralSpread; featuresAllocation.spectralSkewness = features.spectralSkewness; featuresAllocation.spectralKurtosis = features.spectralKurtosis; featuresAllocation.spectralCrest = features.spectralCrest; featuresAllocation.chroma = features.chroma; featuresAllocation.loudness = features.loudness; featuresAllocation.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.