How to get MFCC with TarsosDSP?

前端 未结 2 1040
感动是毒
感动是毒 2021-01-14 12:32

I searched everywhere and I couldn\'t figure out how to extract MFCC feature using TarsosDSP on Android. I know how to get FFT out of a file. Any help?

2条回答
  •  我在风中等你
    2021-01-14 13:16

    you can get the mfcc under the process event, i think that it is for each frame

        int sampleRate = 16000;
        int bufferSize = 512;
        int bufferOverlap = 128;
        new AndroidFFMPEGLocator(this);
        final ListmfccList = new ArrayList<>(200);
        InputStream inStream = new FileInputStream(audioFilePath);
       AudioDispatcher dispatcher = new AudioDispatcher(new UniversalAudioInputStream(inStream, new TarsosDSPAudioFormat(sampleRate, bufferSize, 1, true, true)), bufferSize, bufferOverlap);
        final MFCC mfcc = new MFCC(bufferSize, sampleRate, 20, 50, 300, 3000);
        dispatcher.addAudioProcessor(mfcc);
        dispatcher.addAudioProcessor(new AudioProcessor() {
    
            @Override
            public void processingFinished() {
            }
    
            @Override
            public boolean process(AudioEvent audioEvent) {
                mfccList.add( mfcc.getMFCC());
                return true;
            }
        });
        dispatcher.run();
    

提交回复
热议问题