我如何放大声音在AS3分贝指定数量? [英] How do I amplify sounds by a specified number of decibels in AS3?

查看:303
本文介绍了我如何放大声音在AS3分贝指定数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几天前,这是我的问题,我找到了答案。也许这将帮助别人。

A few days ago, this was my question, and I found the answer. Maybe this will help someone else.

一个。这个问题的第一部分:可以使用Flash你放大声音?在AS3文档的SoundTransform说,这对卷属性:

A. The first part of the problem: can you amplify sound using Flash? The AS3 documentation for SoundTransform says this about the volume attribute:

的音量范围从0(静音)至1(最大音量)。

"The volume, ranging from 0 (silent) to 1 (full volume).

目前面值,这意味着你只能让声音更安静。事实上,如果您对供应大于一(1.0)的数值,声音都会被放大。你可能会饱和的声音,并获得质量差,但你可以做到这一点,而对于语音,你可以逃脱了很多。 (音乐是那么宽容,所以实验。这种方法不执行动态COM pression,这是更适合的音乐。)

At face value, this means you can only make sounds quieter. In fact, if you supply a value greater than one (1.0), sounds will be amplified. You risk saturating the sound and getting poor quality, but you can do it, and for voice, you can get away with a lot. (Music is less forgiving, so experiment. This method does not do dynamic compression, which is better suited to music.)

乙。问题的第二部分:在你做事情的顺序

B. The second part of the problem: the order in which you do things.

右:

soundTransform = new SoundTransform();
soundTransform.volume = volume * volumeAdjustment;
audioChannel.soundTransform = soundTransform;

错误的:

soundTransform = new SoundTransform();
audioChannel.soundTransform = soundTransform;
soundTransform.volume = volume * volumeAdjustment;

我做了CS3和CS4一些测试,并得到了不同的结果。在CS3,我可以设置后的变换音量audioChannel.soundTransform =的SoundTransform;一切都还顺利。但在CS4它没有任何效果。我怀疑CS3使用通过引用传递设置的SoundTransform,而CS4采用按值传递语义和拷贝传递给它的对象。 CS4的方法是更好的设计,但没有打破我在CS3中工作得很好code。

I did some testing in CS3 and CS4, and got different results. In CS3, I could set the volume on the transform AFTER "audioChannel.soundTransform = soundTransform;" and everything was fine. But in CS4 it had no effect. I suspect that CS3 used pass by reference to set the soundTransform, while CS4 uses pass by value semantics and copies the object passed into it. The CS4 approach is better designed, but did break my code that worked fine in CS3.

℃。最后一个问题,是如何将一个分贝值转换为一个因素可以由体积相乘来扩增(或安静)的声音由所需量

C. The last question, is how to convert a decibel value to a factor that can be multiplied by the volume to amplify (or quiet) the sound by the desired amount.

var multiplier:Number = Math.pow(10, decibels / 20); // Power vs. amplitude

注意,分贝可以是一个正数(扩增)或负数(使安静)。如果分贝为零,没有发生变化。

Note that "decibels" may be a positive number (to amplify) or a negative number (to make quieter). If decibels is zero, no change occurs.

有3个分贝将(为近似)的两倍振幅值。 10分贝值会增加十倍体积(完全一致)。

A value for decibels of 3 will (to a close approximation) double the amplitude. A value of 10 decibels will increase the volume tenfold (exactly).

推荐答案

您分贝计算实际上应该使用20个,不是10:

Your decibel calculation should actually use 20, not 10:

var multiplier:Number = Math.pow(10, decibels / 20);

数字音频的幅度,不是权力(它是一个重新presentation声音pressure,不健全电力)。

Digital audio is amplitude, not power (it's a representation of sound pressure, not sound power).

这篇关于我如何放大声音在AS3分贝指定数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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