audio: eq_iir: tune: add sof_ucm2_eq_generate#10980
Open
singalsu wants to merge 2 commits into
Open
Conversation
Add two small example endpoint frequency-response measurements so the sof_ucm2_eq_generate script added in the following commit can be exercised without external input: sof_ucm2_eq_example.txt 1024x3 (freq Hz, response L, response R) sof_ucm2_eq_example.xlsx identical numeric grid in Excel form Both files share the same [frequency, magnitude...] layout the loader expects, so they also demonstrate the multi-column averaging code path. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an Octave-based generator that fits a combined IIR+FIR EQ from measurement data and emits both SOF IPC4 EQ blobs and a corresponding UCMv2 include file for automatic product config inclusion.
Changes:
- Introduce
sof_ucm2_eq_generate()to load measurements, fit a constrained multi-stage IIR, design a short mid-band FIR residual corrector, and export IPC4 blobs + UCM.conf. - Add a sample comma-separated measurement dataset (
sof_ucm2_eq_example.txt) intended for demonstrating/validating the generator workflow.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/audio/eq_iir/tune/sof_ucm2_eq_generate.m | New Octave function to generate IPC4 EQ blobs and a UCMv2 include from measurement data. |
| src/audio/eq_iir/tune/sof_ucm2_eq_example.txt | Example CSV-like measurement input for the generator. |
309a522 to
8e3cb46
Compare
Collaborator
Author
|
Some issue with the UCM bin blob -> draft |
Add a tuning script that turns a measured endpoint frequency
response into a pair of IIR + FIR blobs and a UCM2 include file
laid out the way alsa-ucm-conf expects. The IIR is a four-biquad
parametric (HP2 + low-Q mid PN2 + LS2 + one fine PN2 corrector)
fit stage-by-stage with fminsearch, and the residual mid-band
delta is picked up by a short minimum-phase FIR.
The script takes the DMI sys_vendor and product_name from
/sys/devices/virtual/dmi/id and an endpoint name, and produces:
ucm2_blobs_sof/ipc4/eq_iir/<endpoint>_<vendor>_<product>_iir.{txt,bin}
ucm2_blobs_sof/ipc4/eq_fir/<endpoint>_<vendor>_<product>_fir.{txt,bin}
ucm2_blobs_sof/product_configs/<SYS_VENDOR>/<PRODUCT_NAME>.conf
The blob file names are lowercased and non-alphanumeric runs are
folded to underscores; the vendor and product directory names are
kept verbatim to match the existing alsa-ucm-conf tree. The .conf
file follows the alsa-ucm-conf sof/product_configs style with a
biquad summary in comments and the two
Define.PostMixer<Endpoint>Playback{Iir,Fir}Blob keys pointing at the
installed /usr/share/alsa/ucm2/blobs/sof/... paths.
Measurement input is a numeric grid with column 1 = frequency in
Hz and one or more magnitude columns in dB that are averaged.
Plain text and Excel/ODS workbooks are both accepted, dispatched
by file extension. The sof_ucm2_eq_example.{txt,xlsx} files added
in the previous commit let the script be run without external
data:
sof_ucm2_eq_generate('example', 'example', 'speaker', \
'sof_ucm2_eq_example.txt');
sof_ucm2_eq_generate('example', 'example', 'speaker', \
'sof_ucm2_eq_example.xlsx');
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
8e3cb46 to
a14e7df
Compare
Collaborator
Author
|
Sounds good now, draft --> proposal. |
Comment on lines
+99
to
+103
| %% Parametric target: keep the corrected response band-limited so the fit | ||
| %% does not chase noise below 100 Hz (below the speaker's useful range) or | ||
| %% brighten the top octave. HP2 100 Hz rolls off sub-bass in the target, | ||
| %% LP2 15 kHz tames the highs. Both the IIR stage fit (stage_rms) and the | ||
| %% FIR design in sof_eq_compute honor eq.t_db that this generates. |
| % Params: [fc, gain, Q]. fc [2000, 4000] Hz, gain [-12, +6] dB, Q [0.5, 1.0]. | ||
| fmin_fit = 400; | ||
| fmax_fit = 7000; | ||
| p1_0 = [2500, -6, 0.4]; |
Comment on lines
+260
to
+267
| eq.fir_length = 63; | ||
| eq.fir_beta = 10; | ||
| eq.fir_minph = 1; | ||
| eq.fir_autoband = 0; | ||
| eq.fmin_fir = 400; | ||
| eq.fmax_fir = 7000; | ||
| fprintf('FIR: length=%d taps, mid band [%d, %d] Hz\n', ... | ||
| eq.fir_length, eq.fmin_fir, eq.fmax_fir); |
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.
This patch adds an automatic UCMv2 configuration generator for SOF equalizers. An example speaker speaker demo case can be run:
It produces for automatic DMI ID names based inclusion to UCM2 the configuration:
The graphical output from Octave can be used for visual check for sane design: