原文链接: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. 当OpenCV遇到VS2019时,以前的配置方式翻车了….
  2. OnInitDialog()函数
  3. 融资2.75亿美元的老牌AR公司,倒了
  4. ALSM_EXCEL_TO_INTERNAL_TABLE
  5. 【python opencv 计算机视觉零基础到实战】二、 opencv文件格式与摄像头读取
  6. Spring aop优雅实现redis分布式锁 aop应用redis分布式锁
  7. android一些若干回调测试
  8. boost_1_48_0 在VS2008下的安装 Boost.Asio安装
  9. 面向.Net程序员的dump分析
  10. db2 语句包括不必要的列表_列表推导和生成器表达式的滥用
  11. mpa和pis_扭矩换算mpa(压力与扭矩换算)
  12. PS:更换证件照背景颜色
  13. win7无法搜索到网络计算机,笔记本win7系统搜索不到无线网络信号怎么解决
  14. 最好用的WIN7WIN10激活工具
  15. 作为面试官,我是如何甄别应聘者的包装程度
  16. Edge 浏览器的收藏夹文档位置——最新版windows10和edge
  17. Git初学--创建版本库
  18. P2973 [USACO10HOL]赶小猪
  19. Python爬虫系列(一)环境搭建,以及简单使用,体验他的强大
  20. ev3 编程中各程序块之间的关联

热门文章

  1. Ubuntu20.04 idea/pycharm 搜狗中文输入法不跟随光标问题
  2. 无法启动Outlook,无法打开Outlook窗口的解决方法
  3. 移动硬盘插在电脑上提示需要将其格式化,我该怎么办?
  4. unity物体边缘发光shader_Shaderlab Notizen 15 Rim Shader(边缘发光)的两种实现形态
  5. zabbix报警收敛
  6. css|direction: rtl;填坑
  7. java 遍历阿斯克吗_身为一个合格的java开发,这些java集合的知识你得知道,写的很细...
  8. 卢俊卿谈亲情让城市充满温暖
  9. 二元光学透镜的分光成像、消色差原理
  10. oracle memory_error,ORA-27102: out of memory Linux-x86_64 Error: 12: Cannot allocate memory