Skip to content
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

[BUG] dmic recording volume is too low #9681

Open
pma1 opened this issue Nov 26, 2024 · 24 comments
Open

[BUG] dmic recording volume is too low #9681

pma1 opened this issue Nov 26, 2024 · 24 comments
Assignees
Labels
bug Something isn't working as expected
Milestone

Comments

@pma1
Copy link

pma1 commented Nov 26, 2024

Describe the bug
The dmic volume is too low even the max volume of input/output is set.

To Reproduce
Set the max volume in gnome-setting.
$ arecord -f cd b.wav

Reproduction Rate
100%

Expected behavior
Clear audio recording.

Impact
It's barely to hear the dmic.

Environment
1)
* Kernel: 6.12 9f16d5e6f2206 (linux/master) Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* SOF: db771bf v2.11.x: add new 2.11.2 topology2 production binaries

  1. Name of the topology file
    • Topology: intel/sof-ipc4-tplg/sof-lnl-rt713-l0-rt1318-l1-2ch.tplg
  2. Name of the platform(s) on which the bug is observed.
    • Platform: ThinkPad X1G13 Intel CPU: Intel(R) Core(TM) Ultra 7 258V

Screenshots or console output
x1g13-mic-low-dmesg.txt

@pma1 pma1 added the bug Something isn't working as expected label Nov 26, 2024
@lgirdwood
Copy link
Member

@pma1 its worth opening up alsamixer here and trying to adjust the gains as this gain may not be mapped into the sound control panel.
@bardliao any comments ?

@pma1
Copy link
Author

pma1 commented Nov 27, 2024

x1g13-alsamixer
screenshot of alsamixer, the caputure volume is max.

@bardliao
Copy link
Collaborator

This is PCH DMIC. @pma1 Can you share the result of amixer -c0 contents?
And try amixer -c0 cset name='Dmic0 Capture Volume' 45

@pma1
Copy link
Author

pma1 commented Nov 27, 2024

$ amixer -c0 cset name='Dmic0 Capture Volume' 45
numid=40,iface=MIXER,name='Dmic0 Capture Volume'
; type=INTEGER,access=rw---R--,values=2,min=0,max=45,step=0
: values=45,45
| dBscale-min=-90.00dB,step=2.00dB,mute=1

After set command above, the volume is still the same low as before.

output of amixer -c0 contents:
amixer-contents.txt

@bardliao
Copy link
Collaborator

@pma1 The mixer setting looks good to me. Can you share the captured wav file? Can you try different formats? Like -fS16_LE -c2 -r48000, -fS24_LE -c2 -r48000, -fS32_LE -c2 -r48000. @singalsu Could it be an DMIC0 Capture IIR Eq issue?

@pma1
Copy link
Author

pma1 commented Nov 27, 2024

arecord-16-24-32.tar.gz

arecord file attached, thanks.

@bardliao
Copy link
Collaborator

@pma1 Can you try arecord -Dhw:0,10 -fS32_LE -r48000 -c2 file.wav?

@pma1
Copy link
Author

pma1 commented Nov 27, 2024

The volume is as low as before.

@singalsu
Copy link
Collaborator

We are in progress of adding DRC and other capture pre-processing. I'll do a pull request to enable it on this topology. It will boost the capture level.

@singalsu singalsu self-assigned this Nov 28, 2024
@singalsu
Copy link
Collaborator

@pma1 Are you able to replace the topology (keep a backup if this fails) with this from my test build? Please unzip it since GH does not allow .tplg attachment. If the installed topology is with different file name with compression, move it so there's no lottery for which topology gets loaded.

sof-lnl-rt713-l0-rt1318-l1-2ch.zip

Then you need to find the control for DRC from "alsamixer -c0" and enable it with key m. You can also enable the TDFB beam for beamformer and set the beam angle to 0 degrees with cursor up/down keys. There's only single angle in the blob so there won't be a steerable beam but future topologies may have it, so it doesn't hurt to set it too.

@singalsu
Copy link
Collaborator

singalsu commented Nov 28, 2024

Once the controls are set, they should persists if you keep using same topology. You can also set the controls from command line, e.g.

amixer -c0 controls | grep Dmic0
amixer -c0 cset name='Dmic0 Capture DRC switch' on
amixer -c0 cset name='Dmic0 Capture TDFB beam switch' on
amixer -c0 cset name='Dmic0 Capture TDFB angle set enum' 0
amixer -c0 cset name='Dmic0 Capture Volume' 100%

@singalsu
Copy link
Collaborator

@pma1 @bardliao It is possible to get even more gain with custom DRC and IIR blobs but I'd not do it with generic topologies but instead with UCM2 runtime rules with matched DMI ID. We have already a framework to control SOF for playback with sof-hda-generic (see https://github.com/alsa-project/alsa-ucm-conf/tree/master/ucm2/blobs/sof) and such should be added capture also and other PC platforms with SDW codec.

@lgirdwood lgirdwood added this to the v2.12 milestone Nov 28, 2024
@pma1
Copy link
Author

pma1 commented Nov 28, 2024

@singalsu
Thanks for your kindly help.

The tplg you uploaded is failed to be loaded, please refer to the dmesg:
6.12-x1cg13-sof-load-fail-dmesg.txt

@lgirdwood
Copy link
Member

@singalsu @ujfalusi see

[    3.937788] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
[    3.937812] sof-audio-pci-intel-lnl 0000:00:1f.3: Direct firmware load for intel/sof-ipc4-lib/lnl/B36EE4DA-006F-47F9-A06D-FECBE2D8B6CE.bin failed with error -2
[    3.937814] sof-audio-pci-intel-lnl 0000:00:1f.3: Library file 'intel/sof-ipc4-lib/lnl/B36EE4DA-006F-47F9-A06D-FECBE2D8B6CE.bin' is missing
[    3.937815] sof-audio-pci-intel-lnl 0000:00:1f.3: failed to find module info for widget drc.100.1 with UUID B36EE4DA-006F-47F9-A06D-FECBE2D8B6CE
[    3.937816] sof-audio-pci-intel-lnl 0000:00:1f.3: failed updating IPC struct for drc.100.1
[    3.937915] sof-audio-pci-intel-lnl 0000:00:1f.3: error: tplg component load failed -22
[    3.937917] sof-audio-pci-intel-lnl 0000:00:1f.3: error: failed to load DSP topology -22
[    3.937918] sof-audio-pci-intel-lnl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22

@pma1 can you ls -l the contents of 'intel/sof-ipc4-lib/lnl/ in the firmware directory. Thanks.

@pma1
Copy link
Author

pma1 commented Nov 29, 2024

@lgirdwood

After copied the intel/sof-ipc4-lib/lnl/ file,

The sound card works, the mic volume it better, but not loud enough.
x1cg13-mic-arecod-better-f-cd.tar.gz

but it keep the same volume even set "amixer -c0 cset name='Dmic0 Capture TDFB angle set enum' 90"
x1cg13-alsamixer-Screenshot_

Set 'Dmic0 Capture TDFB angle set enum' to -90, the vomlume is the same.

dmesg:
6.12-x1cg13-sof-mic-volume-better.txt

@singalsu
Copy link
Collaborator

Thanks for testing it! I noticed there's in similar hda-generic topology gain applied in IIR, so it is still louder than this. I'll do another change to change IIR to amplifying type.

The beam angle should be 0 towards user, that's how to coordinates were defined. But there is no 90 degree beam in the blob, so there is no impact except for beam on/off. Blobs with better control are possible with DMI ID based load by UCM.

@singalsu
Copy link
Collaborator

Can you please try this topology:
sof-lnl-rt713-l0-rt1318-l1-2ch-plus20db.zip

It's very good that you are able to test since I don't have access to a similar PC. Can you try to talk very loud to the microphone when capturing, like people might do in a loud environment like cafe with babble. Does the microphone signal clip or sound distorted?

@pma1
Copy link
Author

pma1 commented Nov 29, 2024

@singalsu

Thank you.

The mic volume is much better, no distorted sound found.

I think this tplg is good.

@singalsu
Copy link
Collaborator

Thanks @pma1 ! I'll proceed with this latest change in this pull request: #9690

The next SOF release should be OK.

@pma1
Copy link
Author

pma1 commented Nov 29, 2024

Thanks to all of you for the great help.

@singalsu
Copy link
Collaborator

singalsu commented Dec 2, 2024

@pma1 Can you please check this smaller fix that would be quick to release as stable-v2.11 update. This change only adds gain to IIR, there's no added DRC and TDFB components. What do you think, does this sufficiently address the issue?

sof-lnl-rt713-l0-rt1318-l1-2ch-iir-only-plus20db.zip

@pma1
Copy link
Author

pma1 commented Dec 2, 2024

@singalsu there is no obviously difference with previous tplg, maybe minor lower volume but hardly noticed.

I think this can fix the issue.

@singalsu
Copy link
Collaborator

singalsu commented Dec 2, 2024

Thanks a lot for testing @pma1 ! @kv2019i @lgirdwood I think then we can proceed with #9698 fix for 2.11.

@lgirdwood
Copy link
Member

Thanks a lot for testing @pma1 ! @kv2019i @lgirdwood I think then we can proceed with #9698 fix for 2.11.

Will merge this as soon as CI is back later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

4 participants