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

Echo canceller removing low frequencies #2479

Open
Massimo-B opened this issue Aug 3, 2023 · 15 comments
Open

Echo canceller removing low frequencies #2479

Massimo-B opened this issue Aug 3, 2023 · 15 comments

Comments

@Massimo-B
Copy link

Massimo-B commented Aug 3, 2023

EasyEffects Version

7.0.5

What package are you using?

Gentoo

Distribution

Gentoo

Describe the bug

Somewhere on the update road from 6.2.8 to 7.0.5 the "Echo canceller" has changed a lot.

Enabling this effect it removes a lot of low frequencies. I'm using the default settings.
I only have effects for the input using a USB condenser microphone, no effects on output side. I'm testing with headphones and the monitor-button on bottom right of the EasyEffects gui. So actually the Echo Canceller has nothing to cancel right now.
The default settings are:
Filter length 100ms
Residual Echo Suppression -70dB
Near End Echo Suppression -70dB
Input/Output 0,0dB

This is my current input effects chain:
Echo Canceller->Noise Reduction->Bass Enhancer->Crystalizer->Exciter->Stereo Tools
but it doesn't matter, I can reproduce with the Echo Canceller only.

I can also reproduce with other microphones.

Offtopic:
Could you elaborate what Echo Canceller does, are there some docs? Looking at qpwgraph it takes my output as input, so I guess it just removes my microphone signal from the output within the range of "Filter Length = 100ms"?
It's a desktop machine used for Teams conference calls and only little audio playback.
Echo Canceller is my most important effect for audio conferences. I'm using an open speaker and open condenser microphone. Actually the Teams application already removes feedback. But often I can't properly remove feedback for the remote side which is annoying for the remote partner. So the remote side speaking hears it's own echo coming from my speaker-to-microphone path. Only sometimes, probably on higher system load on my side. Only workaround then is muting my mic or switching speaker to headphones.
I started adding Echo Canceller, often solving the issue, but not always. Is it the right tool to solve this? Maybe increasing filter length? Actually Echo canceller filter length should only catch my local latency, the remote roundtrip latency should not matter here?

Expected Behavior

No response

Debug Log

No response

Additional Information

No response

@Massimo-B
Copy link
Author

Workaround: I got it solved for now by setting Near End Echo Suppression to highest value -1dB so probably almost disabling this (new?) feature.

How can I test the Echo Canceller effect? Enabling the Monitor-button in easyeffects while having speakers enabled, I still have a destroying feedback from speakers to mic.

@Digitalone1
Copy link
Contributor

Offtopic: Could you elaborate what Echo Canceller does, are there some docs?

The documentation should be available in the menu (you can press F1 to show it). Yelp should be installed to read it.

At the moment some manuals are missing (Speech Processor, new Pitch plugin and the Expander), but the Echo Canceller should be present.

@wwmm
Copy link
Owner

wwmm commented Aug 3, 2023

Somewhere on the update road from 6.2.8 to 7.0.5 the "Echo canceller" has changed a lot.

Definitely. You probably were using the version that was based on GStreamer plugins. Unfortunately when I moved to full PipeWire the echo canceller we used before could not be used anymore. The one we use now is based on the speex library.

I'm testing with headphones and the monitor-button on bottom right of the EasyEffects gui. So actually the Echo Canceller has nothing to cancel right now.

It will depend on how good you headphone is. I had one where a fraction of thee audio played propagated to the headphone built-in mic through vibrations carried by the headphone plastic structure.

I started adding Echo Canceller, often solving the issue, but not always. Is it the right tool to solve this?

I use it on Teams and it often helps. But do not expect perfection from the speex echo canceller. It seems to not be as good as echo canceller based on the webrtc library like the one the GStreamer plugin uses.

How can I test the Echo Canceller effect? Enabling the Monitor-button in easyeffects while having speakers enabled, I still have a destroying feedback from speakers to mic.

This procedure should be enough to test it. Maybe #951 is happening to you. The speex echo canceller does not seem to handle well microphone signals that are too strong. Usually I keep the microphone volume as low as possible to help the echo canceller to work.

@Massimo-B
Copy link
Author

All the offline documentation on F1 or online documentation at https://wwmm.github.io/easyeffects/echocanceller.html is outdated.
It does mention the old settings "Frame size" and "Filter length", but not the new "Residual echo suppression" and "Near end echo suppression". What do these do?
And back to the initial issue, why are low frequencies removed which can be solved by setting "Near End Echo Suppression" to highest value -1dB?

@wwmm
Copy link
Owner

wwmm commented Aug 8, 2023

but not the new "Residual echo suppression" and "Near end echo suppression". What do these do?

Near-end and far-end is a terminology used by the people that research echo cancellation. It is probably better to take a look at the wikipedia entry about this topic https://en.wikipedia.org/wiki/Echo_suppression_and_cancellation. It shows a diagram explaining them.

It does mention the old settings "Frame size" and "Filter length"

Some explanation about them here https://www.speex.org/docs/manual/speex-manual/node7.html#SECTION00740000000000000000

@wwmm
Copy link
Owner

wwmm commented Aug 8, 2023

All the offline documentation on F1 or online documentation at https://wwmm.github.io/easyeffects/echocanceller.html is outdated.

Yes. We have to find time to update it. Same thing with the pitch plugin.

@Massimo-B
Copy link
Author

First of all I need to understand how to properly configure the Echo canceller. Is the right setup to have the Echo canceller filter in the Input chain while having nothing like that in the output chain?

In order to understand the parameter Near End Echo Suppression maybe this quote from wikipedia is related:

Double-talk: It is fairly normal in conversation for both parties to speak at the same time, at least briefly. Because each echo suppressor will then detect voice energy coming from the far-end of the circuit, the effect would ordinarily be for loss to be inserted in both directions at once, effectively blocking both parties. To prevent this, echo suppressors can be set to detect voice activity from the near-end speaker and to fail to insert loss (or insert a smaller loss) when both the near-end speaker and far-end speaker are talking. This, of course, temporarily defeats the primary effect of having an echo suppressor at all.

Does it mean, setting this parameter to -1dB almost disables the effect of detecting activity from the near-end speaker while lowering this to default -70 enables that detection? Then still the primary issue, why does -70dB changes the frequencies a lot removing all low frequencies? It's not usable like that.

I don't understand why double-talk is a problem, as each suppressor should only delete it's own signal, which actually means delete the output signals from input, or in other words only allow signals to pass the input that are not seen on the output. Ok, I have a vague idea that suppressing on both sides while having activity on both sides could be a problem.

Filter Length: I guess this means, the suppressor only suppresses echos within this range and ignores longer echos.

Residual Echo Suppression: I guess this is the main suppression factor.

I still have the issue that sometimes the echo cancelling doesn't work properly. MS Teams should have it's own suppression already. Is it sane to add the EE echo canceller? Often the cancellation is getting worse when system is under high load. Probably the Pipewire latency is getting worse then. I'm using the default QUANTUM of 1024 currently on a i7-3770.

@wwmm
Copy link
Owner

wwmm commented Aug 9, 2023

Is the right setup to have the Echo canceller filter in the Input chain while having nothing like that in the output chain?

Usually the echo canceller are put only in the microphone pipeline. The only situation where I found it useful in the output effects pipeline was the one where other people where causing echos in the meeting. In this case putting the echo canceller in the microphone pipeline is useless.

As I am not an expert in echo cancellation and I did not read the speex library source code I am not sure about what it does under the hoods. And its documentation do not tell much about how the suppression parameters operate on the signal https://www.speex.org/docs/api/speex-api-reference/group__SpeexPreprocessState.html#gf846e75a310b9493b2380b11c22ea7dd.

MS Teams should have it's own suppression already. Is it sane to add the EE echo canceller?

If the one buit-in in MS Teams is enough to remove the echo you do not have to put more cancellers in the pipeline.

Often the cancellation is getting worse when system is under high load. Probably the Pipewire latency is getting worse then.

Run the commmand pw-top when this situation happens. It will show the current quantum and sampling rate used by pipewire. With them the server latency can be estimated. And it will also be possible to see if there are xrun errors happening.

@Massimo-B
Copy link
Author

Massimo-B commented Aug 9, 2023

If the one buit-in in MS Teams is enough to remove the echo you do not have to put more cancellers in the pipeline.

Neither MS Teams alone nor in combination with EE Echo canceller is removing echo in all situation, eventhough the combination on a idle machine it often works as expected.
I guess a good test scenario would be to use some remote control to my machine while doing a remote call to it and playing with the echo canceller parameters to check the echo...

@wwmm
Copy link
Owner

wwmm commented Aug 9, 2023

Neither MS Teams alone nor in combination with EE Echo canceller is removing echo in all situation

Even if the microphone volume is reduced? This is a known weakness of our echo canceller. High mic volumes do not work well with it.

@Massimo-B
Copy link
Author

At least the removing of low frequencies is not fixed by reducing mic volume to about 70%.
Please could you try to reproduce this main issue?

@wwmm
Copy link
Owner

wwmm commented Aug 14, 2023

I can't properly test this right now. But searching on google I've found some old e-mails in the speex library list that talk about a high-pass filter in its implementation http://lists.xiph.org/pipermail/speex-dev/2009-December/007567.html. If things are still like this the removal of low frequency is explained. It does not seem there is a way to disable it. in this library.

@Massimo-B
Copy link
Author

That would not explain why I can avoid the unwanted highpass filtering by almost disabling Near End Echo Suppression.

Not sure where the upstream project Speex is officially hosted and discussed, but I tried filing an upstream bug report:
https://gitlab.xiph.org/xiph/speex/-/issues/2043

@Massimo-B
Copy link
Author

Nothing happening upstream. Is that project still maintained?
If EasyEffects is completely based on upstream project for effects, then we cannot file any bugs about the effects here, true? Or is it only a part of the effects coming from upstream?

@wwmm
Copy link
Owner

wwmm commented Jul 4, 2024

Nothing happening upstream. Is that project still maintained?

Considering how popular it is I would guess it is still maintained. The last commit in their repository is from 4 weeks ago. But I would imagine that after all these years development pace is probably slow because the library is very mature at this point.

If EasyEffects is completely based on upstream project for effects, then we cannot file any bugs about the effects here, true? Or is it only a part of the effects coming from upstream?

I have written myself only some simple plugins like the crystalizer, the autogain and the level meters. Almost all of the plugins used in EasyEffects are from third party projects that have been around for a longer time and have a different audience as main target. Changes to these libraries cannot be done on our side. I do not even have the necessary knowledge for that.

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

No branches or pull requests

3 participants