If you're using the Java Sound API, you can set the volume with the MASTER_GAIN control.
import javax.sound.sampled.*;
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(
new File("some_file.wav"));
Clip clip = AudioSystem.getClip();
clip.open(audioInputStream);
FloatControl gainControl =
(FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
gainControl.setValue(-10.0f); // Reduce volume by 10 decibels.
clip.start();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…