Skip to content

Audio: MFCC: Use the MFCC module as compress PCM encoder with discontinuous stream - #10814

Merged
lgirdwood merged 4 commits into
thesofproject:mainfrom
singalsu:mfcc_compress_encoder
Jun 18, 2026
Merged

Audio: MFCC: Use the MFCC module as compress PCM encoder with discontinuous stream#10814
lgirdwood merged 4 commits into
thesofproject:mainfrom
singalsu:mfcc_compress_encoder

Conversation

@singalsu

@singalsusingalsu commented May 26, 2026

Copy link
Copy Markdown
Collaborator

This PR adds commits to previous VAD add PR #10782

  • audio: mfcc: switch to source/sink API, int32 output, and DTX
  • base_fw: advertise BESPOKE codec for MFCC compress capture
  • audio: mfcc: update decode tools and add Python compress scripts
  • tools: topology: add MFCC compress capture for jack and DMIC

A kernel PR for encoder type ALSA controls fix is needed to run this.

@singalsusingalsu changed the title qAudio: MFCC: Use the MFCC module as compress PCM encoder with discontinuous streamMay 26, 2026
@singalsu

Copy link
Copy Markdown
CollaboratorAuthor

Note: To run the MFCC compress topologies, need kernel patches thesofproject/linux#5647 and thesofproject/linux#5789.

Comment threadsrc/audio/mfcc/mfcc.c Outdated
Comment threadsrc/audio/mfcc/mfcc.c
Comment threadsrc/audio/mfcc/mfcc_generic.c Outdated
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from d5267b3 to 969d644CompareMay 27, 2026 08:16
@singalsusingalsu changed the title Audio: MFCC: Use the MFCC module as compress PCM encoder with discontinuous stream[DNM] Audio: MFCC: Use the MFCC module as compress PCM encoder with discontinuous streamMay 27, 2026
@singalsu
singalsu marked this pull request as ready for review May 27, 2026 09:54
CopilotAI review requested due to automatic review settings May 27, 2026 09:54

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the SOF MFCC component and related tooling/topology to support VAD + DTX behavior and to use MFCC as a compress PCM “encoder” that can emit discontinuous (DTX-suppressed) feature frames, including optional IPC4 control notifications for VAD state.

Changes:

  • Add MFCC VAD/DTX support in firmware (new VAD implementation, frame header with VAD/energy fields, optional IPC4 notifications, and compress-output mode).
  • Add/adjust topology2 definitions to expose MFCC feature capture for both normal PCM and compress PCM on SDW jack/DMIC, including new build targets.
  • Update MFCC tuning/export and host-side decode/visualization/transcription tools (Matlab/Octave + Python scripts), plus new documentation.

Reviewed changes

Copilot reviewed 40 out of 40 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
tools/topology/topology2/platform/intel/sdw-jack-audio-feature.confAdds MFCC frame sizing define and VAD mixer control naming for jack feature capture.
tools/topology/topology2/platform/intel/sdw-jack-audio-feature-compress.confNew compress PCM MFCC feature-capture topology for jack (MFCC encoder type, blob selection, VAD control).
tools/topology/topology2/platform/intel/sdw-dmic-audio-feature.confAdds MFCC frame sizing define and VAD mixer control naming for DMIC feature capture.
tools/topology/topology2/platform/intel/sdw-dmic-audio-feature-compress.confNew compress PCM MFCC feature-capture topology for DMIC (MFCC encoder type, blob selection, VAD control).
tools/topology/topology2/platform/intel/dmic1-mfcc.confRenames MFCC bytes control and adds VAD mixer control naming.
tools/topology/topology2/include/pipelines/cavs/host-gateway-src-mfcc-capture.confAdds MFCC_FRAME_BYTES-driven ibs/obs to support variable-sized (compress) MFCC frames.
tools/topology/topology2/include/components/mfcc/mel80.confUpdates exported MFCC configuration blob.
tools/topology/topology2/include/components/mfcc/mel80_compress.confNew exported MFCC configuration blob for compress output.
tools/topology/topology2/include/components/mfcc/mel80_compress_dtx.confNew exported MFCC configuration blob for compress output + DTX.
tools/topology/topology2/include/components/mfcc/default.confUpdates exported default MFCC configuration blob.
tools/topology/topology2/include/components/mfcc/ceps13_compress_dtx.confNew exported MFCC configuration blob for cepstral output + compress + DTX.
tools/topology/topology2/include/components/mfcc.confAdds mixer control template to MFCC widget and allows type override (e.g., encoder).
tools/topology/topology2/include/common/common_definitions.confAdds default feature flags for SDW jack/DMIC compress MFCC capture.
tools/topology/topology2/include/bench/mfcc_controls_playback.confEnables an MFCC mixer switch control in bench playback controls.
tools/topology/topology2/include/bench/mfcc_controls_capture.confEnables an MFCC mixer switch control in bench capture controls.
tools/topology/topology2/development/tplg-targets.cmakeRenames MFCC topology targets and adds compress MFCC mel/ceps variants with frame sizing + blob selection.
tools/topology/topology2/cavs-sdw.confAdds feature-gated includes for new compress MFCC capture topologies.
src/include/user/mfcc.hExtends MFCC config ABI with VAD/DTX/compress flags and timing parameters.
src/include/sof/audio/mfcc/mfcc_vad.hNew VAD API/state definitions for MFCC.
src/include/sof/audio/mfcc/mfcc_comp.hRefactors MFCC component interfaces (source/sink API, frame header, VAD/DTX state, IPC4 helpers).
src/audio/mfcc/tune/sof_mel_to_text_live_dsp_vad.pyNew live Whisper transcription script using DSP VAD embedded in PCM stream.
src/audio/mfcc/tune/sof_mel_to_text_live_compress.pyNew live Whisper transcription script for compress PCM + DTX/discontinuous frames.
src/audio/mfcc/tune/sof_mel_spectrogram_compress.pyNew live mel spectrogram viewer for compress PCM MFCC frames.
src/audio/mfcc/tune/sof_ceps_spectrogram_compress.pyNew live cepstral viewer for compress PCM MFCC frames.
src/audio/mfcc/tune/setup_mfcc.mUpdates blob export for new config layout; adds compress + DTX blob exports.
src/audio/mfcc/tune/README.txtRemoved in favor of README.md.
src/audio/mfcc/tune/README.mdNew markdown documentation for tuning, decoding, and live scripts.
src/audio/mfcc/tune/decode_mel.mUpdates decoder for new int32 + header format and DTX gap filling.
src/audio/mfcc/tune/decode_ceps.mUpdates decoder for new int32 + header format and DTX gap filling.
src/audio/mfcc/tune/decode_all.mUpdates batch decode to new decoder signatures and int32 outputs.
src/audio/mfcc/mfcc.cMoves MFCC to source/sink API processing, hooks VAD notifications and compress/DTX behavior.
src/audio/mfcc/mfcc_vad.cNew VAD implementation (noise floor tracking + weighted energy + hangover).
src/audio/mfcc/mfcc_setup.cAdds VAD init, DTX/compress state init, buffer free fixes, sample-rate limit check.
src/audio/mfcc/mfcc_ipc4.cNew IPC4 control notification plumbing for VAD state reporting.
src/audio/mfcc/mfcc_hifi4.cRemoves old stream-buffer source copy implementations (now in common source/sink code).
src/audio/mfcc/mfcc_hifi3.cRemoves old stream-buffer source copy implementations (now in common source/sink code).
src/audio/mfcc/mfcc_generic.cRemoves old stream-buffer source copy implementations (now in common source/sink code).
src/audio/mfcc/mfcc_common.cAdds source/sink copy funcs, header/VAD handling, legacy vs compress output paths, and DTX suppression logic.
src/audio/mfcc/CMakeLists.txtRegisters new mfcc_vad.c and conditionally mfcc_ipc4.c in build.
src/audio/base_fw.cAdvertises BESPOKE codec capability for MFCC compress capture.

Comment threadsrc/audio/mfcc/tune/decode_mel.m Outdated
Comment threadsrc/audio/mfcc/tune/README.md Outdated
Comment threadsrc/audio/mfcc/tune/sof_ceps_spectrogram_compress.py Outdated
Comment threadsrc/audio/mfcc/mfcc_common.c Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 4 comments.

Comment threadsrc/audio/mfcc/mfcc_common.c Outdated
Comment threadsrc/audio/mfcc/tune/sof_ceps_spectrogram_compress.py Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.

Comment threadsrc/audio/mfcc/mfcc_common.c
Comment threadsrc/audio/mfcc/mfcc_common.c Outdated

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 40 changed files in this pull request and generated 7 comments.

Comment threadsrc/audio/mfcc/mfcc_common.c Outdated
Comment threadsrc/audio/mfcc/mfcc_common.c Outdated
Comment threadsrc/audio/mfcc/tune/README.md
Comment threadsrc/audio/mfcc/tune/README.md
Comment threadsrc/audio/mfcc/tune/sof_mel_spectrogram_compress.py Outdated
Comment threadsrc/audio/mfcc/tune/sof_ceps_spectrogram_compress.py Outdated
Comment threadsrc/audio/mfcc/mfcc.c

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated no new comments.

@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from 65792ff to 4ff0a7eCompareMay 29, 2026 10:20
@singalsu
singalsu requested a review from lyakhMay 29, 2026 10:21
Comment threadsrc/audio/mfcc/mfcc_common.c
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from 4ff0a7e to 66743eaCompareJune 3, 2026 10:39
@singalsu
singalsu requested a review from lyakhJune 3, 2026 10:46

@kv2019ikv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good, some notes of newly added python apps.

Comment threadsrc/audio/mfcc/tune/sof_ceps_spectrogram_compress.py
Comment threadsrc/audio/mfcc/tune/sof_mel_spectrogram_compress.py
Comment threadsrc/audio/mfcc/tune/sof_mel_to_text_live_compress.py
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from 66743ea to 687e01bCompareJune 5, 2026 11:56
@singalsu
singalsu requested a review from kv2019iJune 5, 2026 11:59

@lyakhlyakh left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing critical, can be addressed later at the next convenience

Comment threadsrc/audio/mfcc/mfcc.c Outdated
Comment threadsrc/audio/mfcc/mfcc_common.c Outdated

@kv2019ikv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comments addressed.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 32 out of 32 changed files in this pull request and generated 5 comments.

Comment threadsrc/audio/mfcc/tune/sof_mel_to_text_live_compress.py
Comment threadsrc/audio/mfcc/tune/sof_mel_to_text_live_compress.py
Comment threadsrc/audio/mfcc/mfcc_common.c
Comment threadsrc/audio/mfcc/tune/README.md Outdated
Comment threadsrc/audio/mfcc/tune/README.md Outdated
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from e1fa45b to 9f14d81CompareJune 16, 2026 07:17
Switch from process_audio_stream to source/sink API. Add compress
PCM output mode (variable-size frames, no zero padding) alongside
legacy mode (full period with zero-fill).
Unify all output to int32 Q9.23 regardless of source format.
Remove out_data_ptr_32, mel_spectra int16 copy, mfcc_func typedef,
and per-format output functions from mfcc_common/hifi3/hifi4.
Add DTX for compress mode: suppress silence frames after
configurable trailing count, with optional periodic keepalive.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Register SND_AUDIOCODEC_BESPOKE capture in codec info TLV when
CONFIG_COMP_MFCC is enabled so the kernel detects compress capture
support via IPC4_SOF_CODEC_INFO.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Update Octave decode scripts for int32 Q9.23 output and DTX gap
filling. Add DTX blob generation to setup_mfcc.m.
Add Python compress capture tools: sof_mel_spectrogram_compress.py,
sof_ceps_spectrogram_compress.py, sof_mel_to_text_live_compress.py.
Refactor sof_mel_to_text_live_dsp_vad.py to use shared compress
capture code. Add README with usage examples.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from 9f14d81 to 4c40079CompareJune 16, 2026 07:24
This patch adds build of two development topologies with
discontinous audio features data capture with compress PCMs.
Add sdw-jack-audio-feature-compress.conf (PCM 53, pipeline 132)
and sdw-dmic-audio-feature-compress.conf (PCM 54, pipeline 133)
for compress MFCC capture with DTX blobs.
Fix buffer sizes: set MFCC obs and host-copier ibs/obs to 344
bytes (24-byte header + 80 x int32). Add mel and ceps compress
topology targets for MTL and ARL. Rename normal MFCC topologies
to *-mfcc-mel-normal for clarity.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsuforce-pushed the mfcc_compress_encoder branch from 4c40079 to 00573f4CompareJune 17, 2026 07:45
@singalsu

Copy link
Copy Markdown
CollaboratorAuthor

quickbuild gave up with this?

@lgirdwood

Copy link
Copy Markdown
Member

quickbuild gave up with this?

None of these files are tested by internal CI today.

@lgirdwood
lgirdwood merged commit 66f2b65 into thesofproject:mainJun 18, 2026
43 checks passed
Sign up for freeto 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.

5 participants

@singalsu@lgirdwood@lyakh@kv2019i