原文链接:http://arunraghavan.net/2011/08/hello-hello-hello/

原作者:Arun Raghavan

注意:此方法处于试验阶段,现阶段基于speex,之后有可能使用webrtc-audio-processing。webrtc-audio-processing 现在处于开发阶段,没文档没sample。

I have a secret to confess. I’ve spent a great deal of time over the last few months talking to myself. I can’t say I haven’t enjoyed it — it turns out my capacity to entertain myself is far greater than initially suspected. But I hear you ask … why?

Here at Collabora, I’ve been building on Wim’s previous work on adding echo cancellation to PulseAudio. Thanks go to Intel for supporting us in continuing this work. Before too long, all this work will be trickling down to your favourite Linux distribution and all your friends will stop hating you.

First, a quick recap on what acoustic echo cancellation (AEC) is. If you already know this, you might want to skip this paragraph and the next. Say you’re on your laptop, and you receive a voice call from your friend. You don’t have a pair of headphones lying around, so you’re just going to use your laptop’s built-in speakers and mic. When your friend speaks, what she says is played out the speakers, but is also captured by the microphone and she gets to hear herself speak, albeit a short while (a few hundred milliseconds or more) later. This is called acoustic echo, and can be frustrating enough to make conversation nigh impossible. There are other types of echo for phone systems, but that’s not interesting to us at the moment.

This problem is common on pretty much all devices that you use to make phone calls. Astute readers will ask why they don’t actually face this problem on their phone. That’s because your phone (or, if you have a cheap phone, your phone company) has special software hidden away that removes the echo before sending your signal along to the other end. On laptops, which are general-purpose hardware, the job of echo cancellation is left to either your operating system (Windows XP onwards, for example) or your chat client (Skype, for example) to provide.

On Linux, we implement echo cancellation as a PulseAudio module (code-ninja Wim Taymans wrote this last year). We use the Speex DSP library to perform the actual echo cancellation. The code’s quite modular, so it’s not very hard to plug in alternate echo cancellers (we even include an alternate implementation, which isn’t quite as effective as Speex).

Recently, we plugged in some more bits from the Speex library to do noise suppression and digital gain control (so you can quit twiddling with your mic volume for the other end to be able to hear you). We also added a bunch of fixes to reduce CPU consumption significantly — this should be good enough to run on a netbook and reasonably recent ARM platforms.

While all this sounds nice, I think a demo would sound (haha!) nicer …

Without AEC:

(or download  ogg ,  aac )

With AEC:

(or download  ogg ,  aac )

This is a recording of a call between my laptop and N900. The laptop is playing audio out the speakers and recording with the built-in mic. What you hear is the conversation as heard on the N900.

All this echo cancelling goodness will come to a Linux distribution near you in the upcoming 1.0 release of PulseAudio. The next version of the GNOME IM client, Empathy (3.2), will actually make use of this functionality. In due time, we intend to make it so that all voice applications will end up using this functionality (so if you’re writing a VoIP application and don’t want to use this functionality, you need to set a special stream property to disable this —filter.suppress="echo-cancel").

For the impatient among you, you can try all this out by getting recent testing versions of PulseAudio (I know packages are available for Ubuntu, Debian, Gentoo and Mageia at least). To force your phone streams to use echo cancellation, just run pactl load-module module-echo-cancel, and you’re done.

There’s still some work to be done, refining quality and using other AEC implementations (in the short-term, the WebRTC one looks promising). Things don’t work at all if you’re using different devices for playback and capture (e.g. laptop speakers and webcam mic). These are things that will be addressed in coming weeks and months.

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

弄了一天终于知道怎么弄了。。。真是丫了个蛋疼。。。

1. 首先需要安装speex,这一步我不确定是不是必须的,但Pulse Audio的作者说要安装那就安吧;

2. 执行pactl load-module module-echo-cancel aec_method=\"speex\",这是参照manal写的;

3. 最坑爹的来了,下面的代码片段在注释所示的链接找的,而且Pulse Audio作者也说要这么做。不过事实上,除了在pactl list中的确能看到加载了echo-cancel模块作为filter外,什么实际效果都没。而且在pacmd中输入list-modules发现echo-cancel的use是0。

// see how-to-use-echo-cancellation-module-in-pulseaudio[http://stackoverflow.com/questions/13363241/how-to-use-echo-cancellation-module-in-pulseaudio]
setenv("PULSE_PROP", "filter.want=echo-cancel", 1);

解决办法是打开pavucontrol,在Playback和Recording选项卡中手动选择对应程序的声音来源为×××echo-cancle×××,关闭窗口后,你的设置会被保存。这里还有个问题,就是到底要为输入还是输出加载回声消除模块。Arch的文档说只需要给录音加载模块就好,如下:

不过吧,经过我在Ubuntu上反复测试,只开任何一个,都没任何效果。当两个都开时,喇叭出来的声音在录音中几乎听不到;

4. 最后,做完这些,要把音量开大点,加载了echo-cancel模块的输出的音量会减小许多,而且声音将明显失真,不过作为语言聊天完全足够了。

Linux语音通话如何消除回声(PulseAudio)相关推荐

  1. 【iOS】iOS语音通话回音消除(AEC)技术实现

    一.前言 在语音聊天.语音通话.互动直播.语音转文字类应用或者游戏中,需要采集用户的麦克风音频数据,然后将音频数据发送给其它终端或者语音识别服务.如果直接使用采集的麦克风数据,就会存在回音问题.所谓回 ...

  2. 语音视频社交中回声消除技术是如何实现的

    导语 社交网络一路激荡走来,先是文字+表情,接着是图片+短视频,现在是语音视频社交强势崛起并成为潮流的时代.语音视频社交将是社交网络的发展趋势,毕竟语音视频才是人类最自然的社交方式.在自然的社交环境中 ...

  3. 语音视频SDK的回声消除技术是如何实现的

    导语 社交网络一路激荡走来,先是文字+表情,接着是图片+短视频,现在是语音视频社交强势崛起并成为潮流的时代.语音视频社交将是社交网络的发展趋势,毕竟语音视频才是人类最自然的社交方式.在自然的社交环境中 ...

  4. Android 平台语音通话及回音消除、噪音消除研究(转)

    一 Android操作系统由来 Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平 板电脑,由Google公司和开放手机联盟领导及开发.尚未有统一中文名 ...

  5. 【转】Android 平台语音通话及回音消除、噪音消除研究

    本文转自博客:https://www.cnblogs.com/jianglijs/p/8583603.html -------------------------------------------- ...

  6. Android 平台语音通话及回音消除、噪音消除研究

    一 Android平台语音通讯 正因为Android平台优越的性能.美观的界面,越来越多人使用Android手机,从而在Android平台上的 语音通话越来越多.语音通话大概流程如下:我认为一个语音通 ...

  7. Android手机间语音通话使用webrtc消除回音

    公司的产品智能门铃当与人通话过程中会产生回音,因此想用webrtc的回音消除模块来消除,所以让我写一个android间语音通话的demo来验证webrtc回音消除模块的效果,下面就是我实现这个demo ...

  8. 游戏陪玩平台源码开发,语音通话中的噪音消除处理

    如果用户在游戏陪玩平台源码使用语音通话的过程中,出现大量噪音将会对用户的体验造成不良的影响,所以在开发时,要将噪音消除掉,具体的处理代码将在下方展现: // 初始化 降噪 Java_com_audio ...

  9. WebRTC 一对一语音通话中音频端到端分段延迟分析

    WebRTC 一对一语音通话中的音频端到端延迟指从一个音频信号被发送端采集,到同一个信号被接收端播放出来这整个过程的时间.音频端到端延迟由多个阶段组成.音频端到端处理的冲采样.混音.回声和降噪等操作会 ...

最新文章

  1. Jetty Cross Origin Filter解决jQuery Ajax跨域访问的方法
  2. [THUWC2017]在美妙的数学王国中畅游
  3. css3实现宽度渐变
  4. 做一个基于python的树莓派MCU性能-温度监控仪表盘
  5. connect: 网络不可达_Java网络编程和NIO详解1:JAVA 中原生的 socket 通信机制
  6. 程序人生之回顾大学前两年----第二篇
  7. 如何模拟Spring bean(版本2)
  8. python 列表索引位置,python – 在列表中查找值的第一个位置
  9. android 内容提供其,Android内容提供者
  10. 上海纽约大学计算机专业怎样,聚焦|对话上纽大计算机科学教授郭斯瑶
  11. 最常见30种NLP任务练手项目汇总
  12. Java基础教程——线程局部变量
  13. c语言学生成绩管理系统总结
  14. 关于ESAPI无法打印debug级别日志
  15. Eclipse将控制台输出信息保存为文件
  16. C#中的几个线程同步对象
  17. 网络架构及其演变过程
  18. [BZOJ4668]冷战
  19. 尚学堂Java第五章所有题目
  20. 视频帧差法实例(matlab实现)

热门文章

  1. 如何学习VB最新总结
  2. LCID表(区域设置ID表)
  3. 特斯拉电池细节_一家超级秘密的电池初创公司暗示其吹过特斯拉,但不会展示商品...
  4. 史上最全的MySQL优化手册
  5. 什么是ROM,RAM,SRAM,SDRAM,DDR,DDR2,DDR3
  6. 学习Linux的常见故障(待更新)
  7. 如何用语音模块SYN6288播报DHT11温湿度传感器传回来的数值
  8. 胆囊炎的病因是怎么引起的?
  9. EAUML日拱一卒-微信小程序实战:位置闹铃 (13)-使用类优化程序结构
  10. 前端面试必会 | 一文读懂 JavaScript 中的 this 关键字