Skip to content

Document MFCC magnitude and DCT conventions - #338

Open
sylvesterkaczmarek wants to merge 1 commit into
ARM-software:mainfrom
sylvesterkaczmarek:docs/mfcc-conventions-54
Open

Document MFCC magnitude and DCT conventions#338
sylvesterkaczmarek wants to merge 1 commit into
ARM-software:mainfrom
sylvesterkaczmarek:docs/mfcc-conventions-54

Conversation

@sylvesterkaczmarek

Copy link
Copy Markdown

Summary

  • document the MFCC processing pipeline and its magnitude-spectrum convention
  • state that APIs with a power exponent must use power=1.0
  • clarify that the window, Mel filter bank, and DCT matrix are caller-supplied rather than hardcoded
  • document the Python helper's HTK Mel formula, lack of filter area normalization, exact DCT-II formula, and first-row scaling
  • expand the corresponding Python helper docstrings

Context

Issue #54 reports large differences between CMSIS-DSP and Librosa and asks which power, dct_type, and norm settings 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 --check
  • python -m compileall -q cmsisdsp/mfcc.py
  • ran a focused NumPy test that compared dctMatrix with the documented closed-form DCT-II coefficients
  • verified the documented HTK frequency conversion and its inverse over representative frequencies
  • reconstructed every packed Mel filter and compared its coefficients with the documented unnormalized triangular formula
  • audited the f16, f32, q15, and q31 MFCC implementations to confirm the magnitude, logarithm, and DCT stages

Documentation generation was not run because Doxygen is not installed locally. The full repository test suite was not run.

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

Successfully merging this pull request may close these issues.

Matching MFCC configuration with Librosa's

1 participant