audio: eq_iir: tune: add sof_mls_freq_resp_local.sh#10981
Open
singalsu wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the MLS-based frequency response tuning workflow by making sof_mls_freq_resp.m more reusable (configurable config paths + output directory) and by adding a new helper script to generate local ALSA configs and optionally run the measurement end-to-end.
Changes:
- Extend
sof_mls_freq_resp.mto accept playback/capture config paths and an output directory, improve path handling, and save a PNG plot alongside the CSV. - Add
sof_mls_freq_resp_local.shto auto-detect local ALSA speaker/mic, generatemls_*_config.txt, optionally prep DSP controls, and optionally run Octave.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/audio/eq_iir/tune/sof_mls_freq_resp.m | Adds config/output-dir parameters, improves path robustness, and adds PNG plot output. |
| src/audio/eq_iir/tune/sof_mls_freq_resp_local.sh | New local helper to detect ALSA devices, generate configs, optionally prep DSP state, and run Octave. |
cfa0d5c to
d014c03
Compare
d014c03 to
19b805d
Compare
Clean up a handful of latent bugs and rough edges in the MLS response
measurement helper without touching its behavior in the common paths.
The cell-array labels[] slots were being assigned with (), which wraps
the string into a nested cell instead of using it as the label under
Octave. The sync-marker overlay was calling plot(ts(si), r(si), 'g')
on a matrix r, so with more than one capture channel the linear
indexing wrapped into the wrong channel. addpath() used a CWD-relative
path and the matching rmpath at end-of-function never ran on error;
both are now resolved from mfilename('fullpath') and paired via
onCleanup. The system() wrappers now quote every path argument (new
shq helper, verified round-trippable) and go through a run_shell()
wrapper that raises on non-zero status instead of letting a broken
scp/aplay/arecord silently propagate as NaNs later on.
Smaller items: y is preallocated and asserted for consistent nt across
playback channels; the 1 kHz normalization frequency becomes a named
f_align_hz constant with an empty-bin guard; get_calibration() uses
onCleanup(fclose), handles an empty description, and prefers ~isempty
over length()>0; local variable dir renamed to tmp_dir to stop
shadowing the builtin; capture_level_min_db comment typo fixed; the
docstring header now matches the actual function name; get_config()
carries a warning comment documenting that config files are executed
via eval and must be locally trusted.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
19b805d to
5c20663
Compare
5c20663 to
e12389a
Compare
e12389a to
705cdfc
Compare
Collaborator
Author
|
An issue seen with one PC, fixing it ... |
Add a bash driver that turns the older manually-edited mls_play_config.txt / mls_rec_config.txt workflow into a one-shot "detect + configure + optionally measure" script for the local host. All artifacts (configs, MLS reference, per-channel captures, CSV, PNG plot) land under a per-run data subdirectory so the tune directory does not fill up with per-machine files. aplay -l and arecord -l are parsed to enumerate PCM devices. Speaker preference is: descriptor named "Speaker" first (SOF SDW cards advertise literal endpoint names), then SOF+Analog, then any Analog, then the first non-HDMI/DP/Deepbuffer device. Mic preference is a known calibrated measurement mic (UMM-6, UMIK, MiniDSP, EMM-6, ECM8000) first, then any non-webcam USB card, then SOF DMIC, then analog. --speaker / --mic override both. The auto id is sanitize(DMI vendor + product) plus a mic tag, and gets a -2/-3/... suffix when a prior run's outputs are already in the data dir so re-measuring at a new mic position never clobbers old captures. Capture format and channel count are probed with arecord --dump-hw-params. S32_LE is preferred over S16_LE so the SOF DMIC PCM (which only exposes S32_LE) works out of the box, and the default channel count is the mic's advertised maximum. Optional --cal PATH threads a two-column [freq_hz, mag_db] microphone calibration file into rec.cal for sof_mls_freq_resp.m. Opt-in --prep loads IPC4 pass-through blobs into the speaker card's IIR/FIR bytes controls and turns DRC/MBDRC/TDFB switches off. Both amixer and sof-ctl are invoked via the iface=MIXER,name='...' / -c name='...' forms because numid-based access misreports max sizes and trips a snd_ctl_elem_info() assertion on current alsa-utils. Every external ioctl is wrapped in timeout(1), and each bytes control's actual max size is probed before writing so 1-byte topology stubs get skipped instead of crashing sof-ctl. sof_mls_freq_resp.m gains three optional arguments (play_config_fn, rec_config_fn, data_dir), a `pkg load signal;` up front so distros where octave-signal is separate fail cleanly, and an mls-<id>.png plot next to the CSV. Existing callers using the old positional signature keep working via defaults. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
705cdfc to
72a7b24
Compare
Collaborator
Author
Now it's OK. |
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.
No description provided.