Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MFCC, unnecessary DCT reuse #42

Open
sonicmouse opened this issue Jan 20, 2015 · 1 comment
Open

MFCC, unnecessary DCT reuse #42

sonicmouse opened this issue Jan 20, 2015 · 1 comment

Comments

@sonicmouse
Copy link

In the class Mfcc.cpp, you have this function "calculate()",

   32     std::vector Mfcc::calculate(const SignalSource &source,
   33                                         std::size_t numFeatures)
   34     {
   35         auto spectrum = m_fft->fft(source.toArray());
   36 
   37         Aquila::MelFilterBank bank(source.getSampleFrequency(), m_inputSize);
   38         auto filterOutput = bank.applyAll(spectrum);
   39 
   40         Aquila::Dct dct;
   41         return dct.dct(filterOutput, numFeatures);
   42     }

Every time you call "calculate()", a new DCT is created (line 40). You need to pull the DCT object out of the calculate() scope and put it in the class scope privately.

You have a lot of heavy lifting in DCT, especially with the cosign tables. You even go through all the trouble of caching the cosine tables! So, take advantage of that.

The MFCC calculation will speed up tremendously, especially if you are doing tons of calculations on data that is the same size.

Great job on the library... I have been using it successfully. Ported most of it back to C++98 (had to -- working on a legacy project)

Thanks!

@sqbing
Copy link

sqbing commented Mar 20, 2015

@sonicmouse Hi, i am trying to port aquila to C++98, too. How is your porting library going? Any open source plan?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants