Skip to content

Topology: Add high-pass EQ with gain into DMIC capture pipeline - #1725

Merged
tlauda merged 3 commits into
thesofproject:masterfrom
singalsu:add_mic_eq_gain_min_channels
Aug 19, 2019
Merged

tlauda merged 3 commits into
thesofproject:masterfrom
singalsu:add_mic_eq_gain_min_channels

Conversation

@singalsu

@singalsu singalsu commented Aug 13, 2019 •

Copy link
Copy Markdown
Collaborator

This patch set for topology and EQ tool contains

  • Updates to topology to increase default gain of DMIC capture by +20 dB
  • Decrease volume max. gain by 10 dB 30 -> 20 dB, lower number of steps 80 -> 70. Previous pipeline max. possible gain was +30 dB. Now it is +40 dB. I did the 10 dB drop because I felt +50 dB would have been excessive.
  • Prevent capture of 2ch from 4ch configured pipeline. Attempt to capture 2ch created corrupted audio without any errors returned to arecord.
  • Update paths into script that generates example IIR EQs and add 16 kHz rate high-pass

See commit messages for detailed description

@plbossart

Copy link
Copy Markdown
Member

@singalsu thanks, this is a nice improvement. see below the results on my WHL device. seems to work much better than anything I tried before :-)

pr1275-2
plb.wav.gz

@RanderWang

RanderWang commented Aug 14, 2019 •

Copy link
Copy Markdown
Collaborator

@ClarexZhou Could you help to check the effect on DELL laptop? it is for bug 1131

@ClarexZhou

Copy link
Copy Markdown

Test on CML HDA notebook. DMIC6 and DMIC7 default volume is 100. PGA10 and PGA11 volume max is changed to 70, previous is 80. Captured audio is loud than before in same volume level.

bug 1131 is fixed, audio captured in 50% and output can be heard.

@singalsu

Copy link
Copy Markdown
Collaborator Author

@RanderWang Do you have ideas why the ICL RVP CI fails?

@singalsu

Copy link
Copy Markdown
Collaborator Author

@plbossart Nice, thanks for testing and confirming it's OK with four microphones. I have here a two microphones device.

@singalsu
singalsu force-pushed the add_mic_eq_gain_min_channels branch from 7a09852 to d44ade6 Compare August 14, 2019 10:14
@singalsu

Copy link
Copy Markdown
Collaborator Author

I updated this PR. There's no changes into topology files but I added the EQ instance identifiers placement into the IIR example generator script so the used EQ configs can be used without manual edits into m4 data files. I forgot it from the previous version of PR. Also I added commit description text into first commit.

@singalsu

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

Comment thread tools/topology/sof-hda-generic.m4 Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this supposed to be here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if there's any overhead of having this. I'll check if it impact *.tplg files. With DEBUG_START - DEBUG_END we are able to plot the topology as described in

https://thesofproject.github.io/latest/developer_guides/topology/topology.html#debugging-topology

Some topologies have them and some do not.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this fix/enhance does not depend on the DEBUGs so I think I should remove them from this PR.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the DEBUG should not propagate to .conf or .tplg file if you are just using the m4 and alsa tools as defined in makefiles. As you said it is just a helper to plot the graph. And you can just remove it as it is not part of this PR. Anyway, good to spread the info how to plot the topology :)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Comment thread tools/tune/eq/example_iir_eq.m Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this is just using a biquad to do the dcblocking effect? Just wondering about porting over our first order solution as well so we can port our tuning configs straight over when the time comes.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it's the simple N biquads in series filter. It's now optimized with intrinsics for HiFi3 so there's not much overhead. This is just a single biquad. A 1st order version would work here as well. I've configured this to provide also the 20 dB gain since today we cannot define in topology the initial volume gain to be other than firmware default 0 dB.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we will able set the initial gain for volume instances in topology I'd revert the gain of high-pass to 0 dB. With this topology the user is not able lower the gain if the capture would clip under high sound pressure levels. But since the devices that use this topology are notebooks I'd assume it's not an issue in practice.

The initial volume passing to firmware from topology would need an ABI bump. It's one idea to address the issue with default gains.

Also the volume scale could be defined to be e.g. +20 .. +50 dB then volume comp would use the lowest gain in scale as default. But then gain could not be adjusted to any lower than +20 dB. So This is what I proposed then as full rationale explained!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the reason this is fixed to 16kHz simply because that is what the tuning parameters were set for?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's Intel FW legacy to setup the DAI for 48 kHz and 16 kHz configurations and we are following it. The 16 kHz is a typical sample rate for automatic speech recognition. Though in SOF case it could be a different rate to match needs.

This patch fixes the wrong file path to output example EQs and places
an identifier string to high-pass responses used in topology embedded
filter setup. The identifier is needed to correctly refer in topology
to right response when there are several similar type EQs in the
topology e.g. two separate IIR filters.

A new 16 kHz rate high-pass filter export is added into the script to
be used in voice pipelines.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch replaces minimum channel count two by PIPELINE_CHANNELS to
avoid corrupted capture audio due to capturing other channel count
than what the DAI is configured for.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu force-pushed the add_mic_eq_gain_min_channels branch from d44ade6 to b421698 Compare August 16, 2019 12:53
@singalsu

Copy link
Copy Markdown
Collaborator Author

This PR needed a rebase due to conflicts. I've tested this to work again OK in WHL laptop.

This patch alters topologies those use pipelines definitions from
intel-generic-dmic.m4. The 48 kHz and 16 kHz capture pipelines are
changed to use pipe-eq-capture instead of pipe-volume-capture. The new
pipeline contains volume but also an IIR EQ set for second order
high-pass with 50 Hz cut-off frequency. The IIR includes +20 dB
gain. The volume max is decreased by 10 dB due to the amplifying
IIR add.

The gain in IIR helps with too low capture loudness with default 0 dB
setting for volume. Further gain can be achieved with volume control.

The high-pass filter fixes the issue of too slow DCCOMP settling in
DMIC platform hardware. With IIR add the DMIC unmute ramp is shortened
to 200 ms from 400 ms in the 48 kHz pipeline. In 16 kHz pipeline the
400ms unmute is preserved due to slower DCCOMP settling time.

The min. channels count of two is replaced by pipeline channels count
macro to prevent corrupt capture to happen by capturing as 2ch from
4ch source.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu force-pushed the add_mic_eq_gain_min_channels branch from b421698 to 1d2e965 Compare August 16, 2019 14:26
@singalsu

Copy link
Copy Markdown
Collaborator Author

Once required m4 file was missing from commit - fixed now.

@plbossart plbossart left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM and solves a real problem!

@tlauda
tlauda merged commit b8fa3c7 into thesofproject:master Aug 19, 2019
@singalsu
singalsu deleted the add_mic_eq_gain_min_channels branch January 27, 2021 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants