thesofproject / linux

Linux kernel source tree
Other
90 stars 130 forks source link

DMICs have excessive noise on Thinkpad P1 Gen 6 #4573

Closed jrelvas-ipc closed 11 months ago

jrelvas-ipc commented 1 year ago

Good afternoon,

I've noticed an interesting issue while using my Thinkpad P1 Gen 6. Whenever I record some sound using the machine's single mic array, a very loud background noise is captured, even under conditions where the laptop is on a closed off room, with its internal fans off. This noise can nearly reach -20dB in recordings.

Something worth noting is that the sound differs a lot in the two channels. The left channel sounds just like white noise, but the right channel has more of an "electrical feel" to it and is slightly louder.

Here's how it looks in Audacity: imagem

Here's the recording in question. Zipped due to github restrictions. thinkpad-p1-gen-6-dmic-capture-2.zip

Here's the output of alsa-info.sh: http://alsa-project.org/db/?f=357eeeada21eeda006c3f436a15f425997449c83

I suspect this is internal machine noise, but it's pretty loud, especially since the fans aren't even running. Any idea what the root cause of this is? If so, is there any to fix it, or at least reduce the noise volume?

Thanks in advance.

plbossart commented 1 year ago

We have a recurring issue with Lenovo devices with 2 mics, which seems to be the case for your device @Noted-Jrelvas

[   28.322337] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2

Try to force the use of 4ch with the instructions provided in https://thesofproject.github.io/latest/getting_started/intel_debug/suggestions.html#digital-mic-issues and then maybe we need to use the PDM1 interface (next step in the documentation)

Unfortunately we have no way of discovering how the mics are connected, so some manual setup is required when the hardware differs from the Intel reference.

jrelvas-ipc commented 1 year ago

Thanks for your reply, I've followed your instructions and did the following:

A beep can be heard in channel 3 and 4, just before they go silent.

Here's how the recording looks in Audacity: imagem Recording file: test.zip

Hopefully this information is helpful to you.

plbossart commented 1 year ago

The last two channels are not connected to anything, so that's not an issue with PDM1.

@singalsu you'll have to chime in, I am out of ideas already...

jrelvas-ipc commented 1 year ago

Hmm... Right, that makes sense; I am able to hear recorded sound from the DMICs, it's just ruined by very loud background noise which comes from seemingly nowhere...

FYI, I had a Thinkpad X1 Extreme Gen 5 in my possession for a while and I'm pretty (not exactly) sure it also suffered from the same issue. It's essentially just an older generation (Alder Lake vs Raptor Lake) of the same general hardware, so that should probably rule out hardware defects...

singalsu commented 1 year ago

The first thinkpad-p1-gen-6-dmic-capture-2.wav seems to have noise in first channel and just all zeros in second channel (Octave):

>> [x,fs]=audioread("thinkpad-p1-gen-6-dmic-capture-2.wav");
>> plot(x)
>> max(abs(x(:,1)))
ans = 0.042676
>> max(abs(x(:,2)))
ans = 0
>> 20*log10(sqrt(mean(x(:,1).^2)))
ans = -40.275

It doesn't look like your example with Audacity so I can't further check if there's some possible configuration issue in second channel. The noise level in 4ch test.zip seems to be a lot higher, -29 and -26 dBFS. In first wav the first channel was -40 dBFS. Is there some normalization done in the recording(s) or was this raw capture?

>> [y,fs]=audioread("test.wav");
>> max(abs(y(:,1:2)))
ans =
   0.1639   0.2157
>> 20*log10(sqrt(mean(y(:,1:2).^2)))
ans =
  -28.732  -25.792

It's hard to say if the noise level in these wavs is unusual without reference like normal conversational level speech.

Also the signed SOF FW images no not contain noise suppression so there's no way to post-process the signal. We have a beamformer that could help with noise but it's not included to build.

(Note: could add +3.01 dB to dBFS level equation but as lazy I omitted)

singalsu commented 1 year ago

One more add, the ch1-ch2 level difference of 2.9 dB in latter test.wav is quite large. Do you see similar level difference in a real capture scenario when sound source is symmetrically in near field?

jrelvas-ipc commented 1 year ago

Hey, sorry about the first file, I goofed it up on my end.

It doesn't look like your example with Audacity so I can't further check if there's some possible configuration issue in second channel. The noise level in 4ch test.zip seems to be a lot higher, -29 and -26 dBFS. In first wav the first channel was -40 dBFS. Is there some normalization done in the recording(s) or was this raw capture?

The first was a capture via Audacity. I'm not sure if it did any kind of changes to the recording, but I'm pretty sure not. This discrepancy might be caused by the room. The second recording was done in a room with poor sound isolation; the windows are only single-sided and quite a bit of traffic noise gets through them.

One more add, the ch1-ch2 level difference of 2.9 dB in latter test.wav is quite large. Do you see similar level difference in a real capture scenario when sound source is symmetrically in near field?

Not entirely sure, but the windows were facing left. That might explain the difference. I can try recording myself front and center later and see how different it is.

I've made a brand new recording. This one is in the absolutely most quiet situation I could get myself in. Closed off room in the middle of the house, dead in the night at 3am, laptop fans off. The only sound I can personally hear is my brother's snoring (not through the recording, my actual hearing).

test3.zip

mrhpearson commented 1 year ago

I'm catching up on emails in my inbox (and one of them pointed at this bug).

With regards to "Unfortunately we have no way of discovering how the mics are connected" - I have had some success with this previously with getting schematics. I can only review them with somebody under NDA (so realistically that means somebody at Red Hat, Canonical or Intel). Previously Jaroslav was really helpful and give me some insights into what we were looking at for an older platform and I was able to then work with the codec vendor and get some things fixed.

If that makes sense here, let me know. Especially if there is somebody smarter than me who is willing (and able to do so under NDA) to review documentation. I will go and ask for the schematics and see if I can use my previously acquired knowledge....

I will also try and reproduce this issue. Just swamped for some reason right now - which is frustrating as it's supposed to be the quiet time of the year :(

Mark

jrelvas-ipc commented 11 months ago

Hey everyone, I have a new update for this issue.

Unfortunately, my laptop went through a RMA. One of the places which was replaced was the screen assembly. (which includes the two DMICs)

Fortunately, the noise is almost entirely gone now, with just some very slight white noise still audible. Looks like this was probably a hardware fault, not SOF's. Closing this as completed.

Sorry for the frustration! 😅