Hi
On 22.7.2021 17.40, Daniel Baluta wrote:
Thanks Seppo,
I was able to create a pipeline with EQ via IIR filters (massive warning: i honestly don't exactly know much about signal processing so i may use these terms in a funny way).
I was able to see some differences when playing a song and applying various predefined configurations. So, I think it works:
e.g $ sof-ctl -Dhw:1 -n 44 -s sof/tools/ctl/eq_iir_bassboost.txt
Yep, that looks correct. There should be errors shown if component "-n 44" would have not accepted the new configuration.
Some questions:
- It looks like I'm able to change the parameters at runtime via sof-ctl
although the documentation says that this is only possible only when DSP is idle (documentation might be outdated, it mentions this at v1.4).
So, was this fixed right?
Yes the documentation was not updated. Runtime support during streaming has been there for a while already. Need to fix this.
- Are the files in tools/ctl/ e.g eq_fir_loudness.txt obtained from running
the Matlab script you mentioned (e.g tools/tune/eq?)
Yes, the example scripts there those I mentioned created all the settings files seen in tools/ctl. Also the ones in tools/topology1/m4 for topology embedded blobs.
- How exactly do I make use of Matlab/Octave scripts in tools/tune/eq
For a new EQ design task I would make a copy of e.g. example_iir_eq.m and strip it to minimum. The beef of IIR response definition (bass boost) is lines
eq.peq = [ ... eq.PEQ_HP2 30 NaN NaN ; ... eq.PEQ_LS2 200 +10 NaN ; ... ];
The first HP2 is a 2nd order high-pass with cut-off frequency of 30 Hz. The two NaN parameters mean that HP2 takes only two parameters out of max 4. They could be instead NaN e.g. zeros since they are don't care.
The second filter in this total 4th order design is low-shelf filter with cut-off at 200 Hz and 10 dB boost for low frequencies.
Then, another important one is the scaling of the EQ. The example uses:
eq.norm_type = 'loudness';
It means the perceived overall loudness of the EQ is preserved. An EQ with such normalization can clip with some frequencies so use with care.
Other scaling options are "1k" (preserve unity gain at 1 kHz) or "peak" (max. gain of EQ at any frequency is 0 dB). Only the peak normalization type is totally safe against signal clipping.
It's also possible to shift the overall gain of EQ with other than 0 dB setting for:
eq.norm_offs_db = 0;
- Is there any GUI for modifying the parameters :) .
There is a GUI that was done by Curtis. Run from Octave or Matlab command "gui" from tools/tune/eq directory. It's a good introduction to the parametric design elements like HP2 and LS2.
If the design computer and DUT have a password-less ssh connection it can even update during live playback or capture the EQ response. The scp and ssh commands are handled by eq_deploy_to_dut.m script. The struct "target" needs to be set up correctly.
The GUI has only a subset of features of scripted EQ design features but it's a good tutorial for parametric equalizers design and doing some EQ design quickly without "programming".
Cheers, Seppo
thanks, Daniel.
On Wed, Jul 21, 2021 at 7:56 PM Seppo Ingalsuo seppo.ingalsuo@linux.intel.com wrote:
Hi Daniel,
On 21.7.2021 17.40, Daniel Baluta wrote:
Hi Seppo,
Is there any documentation on how to use the Equalizer component for SOF?
Is there any way to dynamically change the coefficients at runtime?
The documentation is my task list. However there are clear (hope so) examples in tools/tune/eq. See first example_iir_eq.m script. It needs Octave or Matlab with signal-processing package. The IIR equalizers are designed manually with parametric 2nd order blocks. The parameters are usually center frequency, Q-value, and gain.
A more complex example is example_fir_eq.m. FIR can be designed parametrically with prototype IIR as target response or via a direct target response with (frequency, dB magnitude) points. The target can be also computed from delta of desired vs. measured frequency response.
The script example_spk_eq.m shows an EQ that combines both IIR and FIR. IIR is efficient in coarse shape definition and FIR for very detailed, but take care of not going into too small details with it. The FIR response can be controlled with octave bands smoothing.
The run-time control of EQs is documented in https://thesofproject.github.io/latest/developer_guides/tuning/sof-ctl.html
The equalizers (high-pass for some inputs) those are used currently are embedded into topology and do not need runtime setup. See the topology CMakeList.txt for examples of embedding them.
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware