在Java中使用EasySound时,有没有办法控制WAV文件的音量?
我对声音的呼唤看起来像这样,我希望能够更改声音的音量。
EasySound soundOne = new EasySound("sound.wav");
soundOne.play();
My call to the sound looks like this, and I want to be able to change the volume of the sound.
EasySound soundOne = new EasySound("sound.wav");
soundOne.play();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果库不提供动态卷控件,则可以尝试使用
floatControl
,如使用控件的处理音频。使用此方法,我只使用Master_Gain类型成功。此控件的问题在于它同时影响所有播放音频。我还没有发现列出的其他类型是针对不同系统的一致实现的。为此,您可能会遇到困难,以找出库使用的端口。我链接的教程有一个较早的章节,访问音频系统资源哪个处理检查音频系统。
还有另一个相对简单的音频库,它实现了动态卷: audiocue 。免责声明:我是作者。这是基于小的。如果您不知道如何通过通过Maven POM文件链接来使用资源,则一个选项是将五个类/接口将五个类/接口复制到程序中,编辑软件包行以匹配放置它们的文件位置。我目前正在努力弄清楚如何使用相应的JAR文件最好地设置GitHub“发行”,并且还没有提供可以下载的JAR。如果您知道 maven basics ,可以生成罐子项目。
If the library doesn't provide dynamic volume control, you can try using a
FloatControl
as described in Processing Audio with Controls. Using this method, I've only had success with the MASTER_GAIN type. The problem with this control is that it affects all playing audio at the same time. I haven't found the other types listed to be consistently implemented for different systems.For this to work, you might run into difficulties figuring out what port the library uses. The tutorial I linked has an earlier chapter, Accessing Audio System Resources which deals with inspecting your audio system.
There is another relatively simple audio library that has implemented dynamic volume: AudioCue. Disclaimer: I am the author. It's Maven-based. If you don't know how to use a resource by linking via a Maven pom file, one option is to directly copy the five classes/interfaces into your program, editing the package line to match the file location where you place them. I'm currently working to figure out how to best set up github "Releases" with corresponding jar files, and haven't provided a jar that can be downloaded as of yet. The jar can be generated if you know Maven basics and have forked and cloned the project.