Repository navigation
Commit e12389a
committed
audio: eq_iir: tune: add sof_mls_freq_resp_local.sh
Add a POSIX-friendly 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.
Everything (configs, MLS reference, per-channel captures, CSV, plot)
lands under a data subdirectory (default sof_mls_freq_resp_data/) so
the tune directory does not fill up with per-machine artifacts.
Device discovery. aplay -l and arecord -l are parsed to enumerate the
PCM devices. Speaker preference is SOF analog first, any other analog
second, first non-HDMI/DP as a last resort; HDMI and Deepbuffer outputs
are always skipped. Microphone preference is a known calibrated
measurement mic (UMM-6, UMIK, MiniDSP, EMM-6, ECM8000) first, any other
USB audio card that does not look like a webcam second, SOF DMIC array
third, any analog capture fourth. Both picks can be overridden with
--speaker and --mic, and the script prints which rule fired.
Measurement id and file naming. The id is derived from DMI sys_vendor
+ product_name (sanitized to [a-z0-9_]) and then extended with a
sanitized microphone tag so measuring the same laptop with a UMM-6
and with the internal DMIC produces distinct output files instead of
overwriting. --no-mic-tag disables the suffix and --id STR passes the
whole id verbatim. The report block also echoes the raw DMI strings
because the UCM blob generator expects them exactly as they appear in
/sys/devices/virtual/dmi/id.
Capture parameters are probed at runtime. arecord --dump-hw-params is
scanned for FORMAT and CHANNELS. The format is picked as S32_LE if
supported, otherwise S16_LE, otherwise the first advertised value;
this fixes the "Sample format non available" error the SOF DMIC PCM
would otherwise raise because it only exposes S32_LE. Channel count
defaults to the max the mic advertises so DMIC arrays end up recorded
at their native width. --rec-fmt / --mic-ch override each of these,
and --cal PATH threads a two-column [freq_hz, mag_db] microphone
calibration file into rec.cal so sof_mls_freq_resp.m compensates the
measurement with it.
Opt-in DSP prep. --prep programs the speaker card's IIR and FIR bytes
controls with the IPC4 pass-through blobs from tools/ctl/ipc4 and
turns any DRC / MBDRC / TDFB switch off via amixer, so the signal
path is as flat as possible while the MLS is playing. Blob paths
default to tools/ctl/ipc4/eq_{iir,fir}/pass.txt and can be overridden
with --iir-blob / --fir-blob; sof-ctl is invoked with -i 4 so the ABI
header matches an IPC4 topology.
sof_mls_freq_resp.m companion changes. Three optional arguments are
added (play_config_fn, rec_config_fn, data_dir) that default to the
previous hard-coded values so existing callers keep working. The
config helpers thread the file name through, the persistent outputs
(mls-<id>.wav, mls-<id>.txt, mls-ref.wav) go through data_dir, and
the script now also writes mls-<id>.png with the aligned response
plot. The title uses Interpreter 'none' so underscores in the id
render literally instead of as TeX subscripts. meas_remote_rec_config
honors rec.fmt_name / rec.bits from the config when present.
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>1 parent 844c208 commit e12389a
2 files changed
Lines changed: 843 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
11 | 16 | | |
12 | 17 | | |
13 | 18 | | |
| |||
17 | 22 | | |
18 | 23 | | |
19 | 24 | | |
20 | | - | |
| 25 | + | |
| 26 | + | |
21 | 27 | | |
22 | 28 | | |
23 | 29 | | |
| |||
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
29 | 42 | | |
30 | 43 | | |
31 | 44 | | |
| |||
45 | 58 | | |
46 | 59 | | |
47 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
48 | 71 | | |
49 | 72 | | |
50 | 73 | | |
| |||
58 | 81 | | |
59 | 82 | | |
60 | 83 | | |
61 | | - | |
62 | | - | |
| 84 | + | |
| 85 | + | |
63 | 86 | | |
64 | 87 | | |
65 | 88 | | |
| |||
74 | 97 | | |
75 | 98 | | |
76 | 99 | | |
77 | | - | |
| 100 | + | |
78 | 101 | | |
79 | 102 | | |
80 | 103 | | |
| |||
101 | 124 | | |
102 | 125 | | |
103 | 126 | | |
104 | | - | |
105 | | - | |
| 127 | + | |
| 128 | + | |
106 | 129 | | |
107 | 130 | | |
108 | 131 | | |
| |||
129 | 152 | | |
130 | 153 | | |
131 | 154 | | |
132 | | - | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
133 | 165 | | |
134 | 166 | | |
135 | 167 | | |
| |||
159 | 191 | | |
160 | 192 | | |
161 | 193 | | |
162 | | - | |
| 194 | + | |
163 | 195 | | |
164 | 196 | | |
165 | 197 | | |
| |||
198 | 230 | | |
199 | 231 | | |
200 | 232 | | |
201 | | - | |
| 233 | + | |
202 | 234 | | |
203 | 235 | | |
204 | 236 | | |
| |||
218 | 250 | | |
219 | 251 | | |
220 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
221 | 258 | | |
222 | 259 | | |
223 | 260 | | |
224 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
225 | 275 | | |
226 | 276 | | |
227 | 277 | | |
| |||
326 | 376 | | |
327 | 377 | | |
328 | 378 | | |
329 | | - | |
330 | | - | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
331 | 390 | | |
| 391 | + | |
332 | 392 | | |
333 | 393 | | |
334 | 394 | | |
335 | 395 | | |
336 | 396 | | |
337 | 397 | | |
338 | 398 | | |
339 | | - | |
340 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
341 | 409 | | |
342 | | - | |
| 410 | + | |
343 | 411 | | |
344 | 412 | | |
| 413 | + | |
345 | 414 | | |
346 | 415 | | |
347 | 416 | | |
| |||
0 commit comments