-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tools: Topology2: Swap gain and eqiir in DMIC capture #9700
Tools: Topology2: Swap gain and eqiir in DMIC capture #9700
Conversation
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. |
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 <[email protected]>
ea8855e
to
99e857a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, nice fix @singalsu
SOFCI TEST |
Unrelated CI failure for pause and alsabat on LNL |
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.