Header Sep

Java Tips, Tricks & Code

My Rating Score
Login to rate page

May 2004

How to control sound volumes in Java

The maximum volume for ringtones is higher than for the media player and the Java environment.

It is possible to increase the volume within a sound file by using a different compression or by increasing the amplitude and cutting off the tops to get "more room" and therefore a higher volume.

It is also possible to control the volume by using the following methods in the VolumeControl interface:

  • setLevel (int level)
  • setMute (boolean mute)

The player must be in realized state when initializing a control. Get the VolumeControl by using the following code:

VolumeControl vc = (VolumeControl) player.getControl("VolumeControl");


My Rating Score
Login to rate page