GithubHelp home page GithubHelp logo

Comments (5)

hughrawlinson avatar hughrawlinson commented on September 25, 2024 1

Absolutely! The first step would be to do some research and find a few different sources for the definition of this feature. We've found that often, different implementations of features do slightly different things or use slightly different terminology. We want to be approachable for developers coming from other tools, and try to keep the terminology we use similar to what other tools do. I'd suggest having a look at YAAFE, librosa, and essentia. Additionally, if there are any academic papers on the subject, those would be useful too. Let me know what you find and we can move on to the next step 😄

from meyda.

hughrawlinson avatar hughrawlinson commented on September 25, 2024 1

Let's keep this issue open to track the implementation?

from meyda.

hughrawlinson avatar hughrawlinson commented on September 25, 2024

I don't think we support that right now, but maybe we could - we support MFCCs, so I would think those are related. Are you interested in working on that?

from meyda.

vemusharan avatar vemusharan commented on September 25, 2024

Thanks a lot @hughrawlinson for quick response. Yes, I would like to work on that. Could you please guide me :)

from meyda.

chenp6 avatar chenp6 commented on September 25, 2024

I'm not sure whether my thought is right or not.
But I guess that the extractMelBands in node_modules\meyda\dist\node\main.js (for CLI and Nodejs) and node_modules\meyda\dist\web\meyda.js (for web) is where compute a mel scaled spectrogram.
However it is log scaled. So I just copy the extractMelBands , comment out the line melBands[i] = Math.log(melBands[i] + 1);for log-transform, and change rename it into extractUnloggedMelBands

function extractUnloggedMelBands(_a) {
       var ampSpectrum = _a.ampSpectrum, melFilterBank = _a.melFilterBank, bufferSize = _a.bufferSize;
       if (!ampSpectrum || !melFilterBank) {
           throw new TypeError("Valid ampSpectrum and melFilterBank are required to generate melBands");
       }
       var powSpec = extractPowerSpectrum({ ampSpectrum: ampSpectrum });
       var numFilters = melFilterBank.length;
       var filtered = new Array(numFilters).fill().map(() => new Float32Array(bufferSize / 2));
       var melBands = new Float32Array(numFilters);
   
       for (var i = 0; i < numFilters; i++) {
           for (var j = 0; j < bufferSize / 2; j++) {
               filtered[i][j] = melFilterBank[i][j] * powSpec[j];
               melBands[i] += filtered[i][j];
           }
           // Skip the log transformation
           // melBands[i] = Math.log(melBands[i] + 1); // commented out for unlogged version
       }
       return Array.from(melBands);
}

And then add a new config for it

 var extractors = /*#__PURE__*/Object.freeze({
        __proto__: null,
        amplitudeSpectrum: amplitudeSpectrum,
        buffer: buffer,
        chroma: chroma,
        complexSpectrum: complexSpectrum,
        energy: energy,
        loudness: loudness,
        melBands: extractMelBands,
        unloggedMelBands: extractUnloggedMelBands, // here!
       .....

Finally, you can use features.unloggedMelBandsto call it

const analyzer = Meyda.createMeydaAnalyzer({
    "audioContext": audioContext,
    "source": source,
    "bufferSize": 512,
    "featureExtractors": ["rms", "mfcc","unloggedMelBands"],
    "numberOfMFCCCoefficients":128,
    "callback": features => {
            console.log(features.unloggedMelBands);
    }
});

from meyda.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.