使用HTML5 / JavaScript的正确的音频输出音量分贝,关闭pre-处理 [英] Correct audio volume output decibels using HTML5 / javascript, turn off pre-processing

查看:3738
本文介绍了使用HTML5 / JavaScript的正确的音频输出音量分贝,关闭pre-处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经观察到,使用基于JavaScript的音频从一个浏览器,其输出电平是不正确地线性比例在许多系统输入信号电平。例如,如果你'玩'两罪波振幅20分贝,从不同的设备产生的差异变化/设置可能20分贝,例如明显不同据关10dB的或更少。
我们需要在相互校准分贝水平扑灭简单的音频信号(如罪波),例如摆了一道正弦波在一个卷,然后拿出另一犯罪浪潮,为20dB比第一个更安静,并有他们居然会有这种结果。
我们想使用HTML5 / JavaScript的浏览器做到这一点。结果
我们试图做这几种方式,如使用pre-创建,校准.mp3文件,直接使用网络音频API生成与校准的分贝水平的振荡器。我们得到(我们)非常令人惊讶,基本上不正确的结果。
当我们测量所得的声音使用校准麦克风出来的设备,各种奇怪的事情已经观察到,这表明音频以线性方式并不只是'打',但复杂的pre-处理正在它做到了真正得到输出前。这似乎取决于各种变量外目前我们无法控制的。它不工作,一个正常的音频放大器的作品,即该20dB的响亮输入产生20dB的响输出,无论绝对级别设置的方式。
我们已经发现,使用相同的JavaScript code产生非常不同的结果取决于各种变量,包括硬件(如浏览在Mac与iPhone),音量设置选择(甚至是相对的通过值20dB用于输入20分贝差异没有什么不同,当音量为1/2),如果耳机使用,等等。

We have observed that using javascript-based audio from a browser, the output level is not correctly linearly proportional to the input signal level on many systems. For example, if you 'play' two sin waves with amplitude varying by 20dB, the resultant difference from different devices/settings may be markedly different from 20dB, e.g. as far off as 10dB or less. We need to put out simple audio signals (e.g. sin waves) at calibrated decibel levels relative to each other, for example put out one sin wave at one volume, then put out another sin wave that is 20dB quieter than the first one, and have them actually come out that way. We would like to do this from a browser using HTML5/javascript.
We have tried to do this in several ways, e.g. using pre-created, calibrated .mp3 files, using the Web Audio API directly to generate an oscillator with calibrated dB levels. We have gotten (to us) very surprising and basically incorrect results. When we have measured the resulting sounds coming out of the device using a calibrated microphone, all kinds of weird things have been observed, indicating that audio is not just 'played' in a linear way, but complex pre-processing is being done on it before it actually gets output. This seems to depend on all kinds of variables currently outside of our control. It does not work the way that a 'normal' audio amplifier works, ie that a 20dB louder input produces a 20dB louder output, whatever the absolute level is set to. We have found that using the same javascript code produces very different results depending on all kinds of variables including the hardware (e.g. browsing on Mac vs. iPhone), the volume settings chosen (even the relative values not different by 20dB for 20dB difference in input when volume is at 1/2), if headphones are used, etc.

在进一步的测试中,看来该首要问题是关系到使用外部扬声器。使用耳机时,结果看的的更好。

In further testing, it appears that the primary problem is related to the use of external speakers. When using headphones, the results look much better.

最根本的问题是,如果你创建具有体积已知的差异,如20分贝两个不同的信号,并把他们两个中的任何几种方法,测得的差异往往不20分贝,而且在某些情况下那样糟糕10dB的。

The basic problem is that if you create two different signals with known differences in volume, eg 20dB, and put them both out in any of several ways, the measured difference will often not be 20dB, and is in some cases as bad as 10dB.

有一些方法以编程方式做到这一点?

Is there some way to programmatically do this?

有没有办法覆盖任何pre-处理或音量COM pression似乎是调节音量(导致输出不正确正比于输入)?

Is there a way to override whatever pre-processing or audio volume compression seems to be adjusting the volume (causing output that is not correctly proportional to input)?

我们需要一种方法来做到这一点,将跨平台(台式机,iOS版,Android版,不同的浏览器,不同的耳机/扬声器)的工作,因此,使用HTML5的。

We need a way to do this that will work across platforms (desktop, iOS, Android, different browsers, different headphones/speakers), hence the use of HTML5.

如果这是不可能做到这一点使用HTML5,我们如何能做到这一点使用本地的iOS / Android的code?这似乎是更多的是硬件比软件问题,但也许有办法将其覆盖。

If it isn't possible to do this using HTML5, how can we do it using native iOS/Android code? This appears to be more of a hardware than a software problem, but perhaps there are ways to override it.

感谢

推荐答案

我们已经通过显著进一步研究回答了这个问题。
详细的测试后,下面的已经很清楚:
1)在所有系统测试的声音振幅产量已经几乎完全1:1使用耳机时线性相关的投入,不管其他设置。这是在多个浏览器,多个设备,iOS版,Android版,OSX,多重动力和无动力耳塞和过度的入耳式耳机真。
使用外部扬声器时1线性相关输入:2)在许多系统/设置/音量水平的声音的振幅输出不是1。相反,声音通常与小于1的斜率的线性,常常显著更少(例如1/2)。除了这个斜率,许多系统也饱和在更高的音量。这似乎是因为补偿机制正在与外部扬声器使用。

We have answered this issue through significant further research. After detailed testing, the following has become clear: 1) On all systems tested the sound amplitude output has been nearly perfectly 1:1 linearly related to input when headphones are used, regardless of other settings. This was true over multiple browsers, multiple devices, iOS, Android, OSX, multiple powered and unpowered ear-bud and over-the-ear headphones. 2) In many systems/settings/volume levels the sound amplitude output is not 1:1 linearly related to input when the external speaker is used. Instead, the sound is often linear with a slope of less than 1, often significantly less (e.g. 1/2). In addition to this slope, many systems also saturate at higher volume levels. This appears to be because compensation mechanisms are being used with external speakers.

因此​​,正确的答案是:用HTML5 / JavaScript的音频生成音频输出幅度接近1:1的线性与输入,只要耳机使用。这是几乎没有1:当外部扬声器上普遍使用的许多设备使用1线与输入

Therefore, the correct answer is: Audio output amplitude generated with HTML5/javascript audio is nearly 1:1 linear vs. input so long as headphones are used. It is not nearly 1:1 linear vs. input when external speakers are used on many devices in common use.

这篇关于使用HTML5 / JavaScript的正确的音频输出音量分贝,关闭pre-处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆