Document MFCC magnitude and DCT conventions - #338
Open
sylvesterkaczmarek wants to merge 1 commit into
Open
Conversation
sylvesterkaczmarek
force-pushed
the
docs/mfcc-conventions-54
branch
from
August 22, 2026 21:12
3d747f4 to
3501e1e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
power=1.0Context
Issue #54 reports large differences between CMSIS-DSP and Librosa and asks which
power,dct_type, andnormsettings the CMSIS-DSP implementation uses.The CMSIS-DSP MFCC functions apply Mel filters to FFT magnitudes rather than squared magnitudes, so the equivalent power exponent is 1. The DCT type and normalization are determined by the coefficient matrix supplied during initialization. The repository's Python helper generates a DCT-II matrix with
sqrt(2 / M)applied to every row, including the first row; this is different from an orthonormal DCT-II. Its triangular filters use the HTK Mel scale and are not area-normalized.Documenting these conventions explains why configurations using
power=2.0, orthonormal DCT scaling, or different Mel filter normalization do not match.Fixes #54.
Validation
git diff --checkpython -m compileall -q cmsisdsp/mfcc.pydctMatrixwith the documented closed-form DCT-II coefficientsDocumentation generation was not run because Doxygen is not installed locally. The full repository test suite was not run.