Tools: Topology2: Swap gain and eqiir in DMIC capture#9700
Merged
lgirdwood merged 1 commit intothesofproject:mainfrom Dec 4, 2024
Merged
Tools: Topology2: Swap gain and eqiir in DMIC capture#9700lgirdwood merged 1 commit intothesofproject:mainfrom
lgirdwood merged 1 commit intothesofproject:mainfrom
Conversation
Collaborator
Author
|
An example of this is in the plot below. The recordings were done with sof-hda-generic-2ch.tplg with simulating very loud sound by rubbing the microphone ports in notebook lid (no yelling in home office :) . The upper plot is before and and lower after this change. In upper with amplifying IIR the peaks are clipped to max. PCM codes and then brought down with volume set to -10 dB. In lower plot with proposed topology change the capture is more linear with no saturated intermediate PCM codes values. |
singalsu
commented
Dec 2, 2024
This patch swaps the order of IIR and gain components in capture pipeline. In IPC4 systems the gain component can only attenuate the signal, largest gain is 0 dB (pass-through). The IIR component can be set up to amplify the signal by e.g. +20 dB that is currently default in many topologies. The gain can possibly distort the signal in loud environment. With current "dai-copier -> eqiir -> gain -> module-copier" topology the user configurable gain (ALSA mixer control) can't prevent clipping of audio signal in IIR. While with swapped order "dai-copier -> gain -> eqiir -> module-copier" using attenuation in gain component can be used to prevent audio signal clipping in IIR. It would be useful in capturing audio in a very loud environment. Since the pipeline is 32-bits there is no practical loss of audio quality even if there would be first attenuation and then gain. Plus normally the gain control for Dmic0 is set to maximum. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
ea8855e to
99e857a
Compare
lgirdwood
reviewed
Dec 2, 2024
lgirdwood
approved these changes
Dec 3, 2024
Member
|
SOFCI TEST |
kv2019i
approved these changes
Dec 3, 2024
Member
|
Unrelated CI failure for pause and alsabat on LNL |
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 swaps the order of IIR and gain components in capture pipeline. In IPC4 systems the gain component can only attenuate the signal, largest gain is 0 dB (pass-through). The IIR component can be set up to amplify the signal by e.g. +20 dB that is currently default in many topologies. The gain can possibly distort the signal in loud environment.
With current "dai-copier -> eqiir -> gain -> module-copier" topology the user configurable gain (ALSA mixer control) can't prevent clipping of audio signal in IIR. While with swapped order "dai-copier -> gain -> eqiir -> module-copier" using attenuation in gain component can be used to prevent audio signal clipping in IIR. It would be useful in capturing audio in a very loud environment.
Since the pipeline is 32-bits there is no practical loss of audio quality even if there would be first attenuation and then gain. Plus normally the gain control for Dmic0 is set to maximum.