简体   繁体   中英

How can I change the volume of an audio file in java

Here is my code:

URL url = this.getClass().getClassLoader().getResource(file);
    AudioInputStream audioIn = AudioSystem.getAudioInputStream(url);
    Clip clip = AudioSystem.getClip();
    clip.open(audioIn);

    clip.loop(Clip.LOOP_CONTINUOUSLY);

What can I add to reduce the volume

If you're using the Java Sound API, you can set the volume with the MASTER_GAIN control.

Check this stackoverflow post: LINK

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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