I hear that setVolume(0-100) is based on logarithms, of which I have yet to learn about. I will do some research, but for now, does anyone know how I could achieve 33% volume and 66% volume? If not, can anyone link a site explaining it?


public static float convertMinMax(int val, float min, float max) { float range = max - min; float newVal = val / (100 / range); return newVal + min; }
public synchronized void setVolume(int level) { this.masterVolume = level; if (soundClip != null) { if (soundClip.isControlSupported(FloatControl.Type.MASTER_GAIN)) { FloatControl volume = (FloatControl) soundClip.getControl(FloatControl.Type.MASTER_GAIN); volume.setValue(SoundUtils.convertMinMax(level, volume.getMinimum(), volume.getMaximum())); } } }