用于双向视频会议的 flash/red5 应用程序中扬声器的回声问题
我刚刚尝试了下面的代码,它可以很好地减少耳机上的回声。但回声问题仍然存在,就像扬声器一样。
public var intCountMilliSec:int = 0;
public var intLastActivityLevel:int = 0;
public var intLastLowestActivityLevel:int = 100;//07-Dec-09
private function CancelEcho(e:TimerEvent):void
{
intCountMilliSec = intCountMilliSec + 50;
if (Red5OutgoingMic.activityLevel > intLastActivityLevel)
{
intLastActivityLevel = Red5OutgoingMic.activityLevel;
}
if (Red5OutgoingMic.activityLevel < intLastLowestActivityLevel)
{
intLastLowestActivityLevel = Red5OutgoingMic.activityLevel;
}
if (intCountMilliSec >= 1500)
{
if (intLastActivityLevel > 20)
{
Red5OutgoingMic.gain *= 0.8;
}
if (intLastLowestActivityLevel < 20)
{
if (Red5OutgoingMic.gain <= 30)
{
Red5OutgoingMic.gain = Red5OutgoingMic.gain/0.8;
}
}
intCountMilliSec = 0;
intLastActivityLevel = 0;
intLastLowestActivityLevel = 0;
}
}
任何立即帮助将不胜感激。
I just tried the below code, and it works fine to reduce the echo on head phones. But the problem of echo remains as it is in case of speakers.
public var intCountMilliSec:int = 0;
public var intLastActivityLevel:int = 0;
public var intLastLowestActivityLevel:int = 100;//07-Dec-09
private function CancelEcho(e:TimerEvent):void
{
intCountMilliSec = intCountMilliSec + 50;
if (Red5OutgoingMic.activityLevel > intLastActivityLevel)
{
intLastActivityLevel = Red5OutgoingMic.activityLevel;
}
if (Red5OutgoingMic.activityLevel < intLastLowestActivityLevel)
{
intLastLowestActivityLevel = Red5OutgoingMic.activityLevel;
}
if (intCountMilliSec >= 1500)
{
if (intLastActivityLevel > 20)
{
Red5OutgoingMic.gain *= 0.8;
}
if (intLastLowestActivityLevel < 20)
{
if (Red5OutgoingMic.gain <= 30)
{
Red5OutgoingMic.gain = Red5OutgoingMic.gain/0.8;
}
}
intCountMilliSec = 0;
intLastActivityLevel = 0;
intLastLowestActivityLevel = 0;
}
}
Any immediate help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您遇到的情况称为反馈,它是硬件问题,麦克风拾取从扬声器发出的声音并通过扬声器再次播放。
通常它会发出尖叫声,但由于 over ip 的延迟,它可以回收声音。这是一个常见问题。
耳机是一种常见的解决方案。另一个解决方案是将音频输出远离音频输入:即将扬声器远离麦克风。
请参阅:http://en.wikipedia.org/wiki/Audio_feedback
what your experiencing is called feedback, its a hardware issue, the microphone picks up the sound emmitting from the speakers and plays it back again through the speakers.
Typically it comes out as a squeal but with the delay of over ip it can just recycle the sound. This is a common problem.
Headphones are a common solution. Another solution is to move your audio output away from your audio input: i.e. move the speakers away from the microphone.
See: http://en.wikipedia.org/wiki/Audio_feedback
您正在寻找的解决方案称为回声消除。不幸的是,现在只有两个选择:
1)在 Flash 中进行回声消除。 Adobe 有能力将其嵌入到 Flash 中,但不幸的是,他们只允许在 Adobe Connect 会议服务器上运行时使用它。蹩脚,但却是事实。
2)您的另一个选择是解码服务器中所有参与者的音频,在那里混合音频,并使用回声消除库消除回声。执行此操作的 C 库的一个示例是 spandsp,但这需要大量额外的代码以及可以从 Flash 进行解码的媒体服务器。 Red5开源服务器可以从Flash接收音频和视频,您可以使用Xuggle库将音频解码为原始音频。不过,消除回声需要与正确的回声消除库集成。
简而言之,除非 Adobe 决定真正在 Flash 中为非 Adobe 专有应用程序启用回声消除功能,否则您将很难解决该问题(即,目前无法通过 ActionScript 解决此问题)。
希望有帮助。
The solution you're looking for is called echo cancellation. Unfortunately today there are only two options:
1) do the echo cancelling in Flash. Adobe has the ability to do this embedded in flash, but unfortunately they only allow it to be used when running against Adobe Connect's conferencing server. Lame, but true.
2) your other option is to decode the audio from all participants in a server, mix the audio there, and remove echo using an echo cancelling library. An example of a C library that does this is spandsp, but this requires a lot of extra code, and a media server that can decode from Flash. The Red5 open-source server can receive audio and video from Flash, and you can use the Xuggle library to decode the audio into raw audio. Removing the echo though would require integration with the right echo canelling library.
In short, unless Adobe decides to actually enable echo-canelling in Flash for non-Adobe-proprietary apps, you're left with a hard road to fix the issue (i.e. there is no way to fix this from ActionScript today).
Hope that helps.