简体   繁体   English

有没有办法将 dB 值分配给特定的音频文件以在扬声器中再现?

[英]Is there a way to assign dB value to a specific audio files for reproduction in speakers?

Most speakers would have a volume knob, but is there a way to modify it for each audio file?大多数扬声器都会有一个音量旋钮,但有没有办法为每个音频文件修改它? My biggest concern is the speaker integrity as to not send too loud of a sound.我最担心的是扬声器的完整性,不会发出太大声。 I can't find a way to get the speakers data so it can be decided if it's safe to play it or not, as I intend to make it work in every speaker.我找不到获取扬声器数据的方法,因此可以确定播放它是否安全,因为我打算让它在每个扬声器中工作。 It's a broad question but I dont even know if it's possible so I dont know where to start.这是一个广泛的问题,但我什至不知道这是否可能,所以我不知道从哪里开始。

Audio files should ideally be at the maximum level that does not distort.理想情况下,音频文件应处于不失真的最高级别。 I could see engaging in preprocessing all your recordings so that they're at a consistent sound level.我可以看到参与预处理所有录音,以使它们处于一致的声级。 That might be sufficient to account for the concern you are raising about client speaker integrity.这可能足以说明您对客户演讲者完整性提出的担忧。

If you want to have the database store a number that reflects how "hot" a particular audio file is, then it seems to me that the amount of effort required to get that number might be comparable or even greater than the effort to preprocess the sounds to a consistent max-with-no-overflow level.如果您想让数据库存储一个反映特定音频文件“热”程度的数字,那么在我看来,获得该数字所需的工作量可能与预处理声音的工作量相当甚至更大达到一致的最大无溢出水平。

Once you have that number, how to make use of it?一旦你有了那个号码,如何使用它? The HTML <audio> tag does not have an amplitude property. HTML <audio>标签没有幅值属性。 So, you would have to make use of some library in your client, such as the Web Audio API, or one of the many libraries that are built on top of it.因此,您必须在客户端中使用一些库,例如 Web Audio API,或者在它之上构建的众多库之一。 With Web Audio API , the relevant point to change the volume is the gain node .使用Web Audio API ,改变音量的相关点是增益节点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM