title: How do I change the decibels of a clip
body: <p>The problem I have is that the decibals of the audiofile only changes from the initial value of programVolume (the variable) but I have a JSlider that alters the the value of the variable;however, it does not alter the decibals of the file. What do I add/change to make sure the decibal changes based off the values set to the variable from the JSlider.</p>
  
  <pre><code>  File fileSong = new File (filePath); 
    AudioInputStream input = AudioSystem.getAudioInputStream(fileSong); 
    clip = AudioSystem.getClip(); 
    clip.open(input); 
    FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
    gainControl.setValue(programVolume);
    clip.start();
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I have added the following code:</p>
  
  <pre><code>  File fileSong = new File (filePath); 
    AudioInputStream input = AudioSystem.getAudioInputStream(fileSong);
    clip = AudioSystem.getClip(); 
    clip.open(input); 
  
    FloatControl gainControl = (FloatControl) clip.getControl(FloatControl.Type.MASTER_GAIN);
    float range = gainControl.getMaximum() - gainControl.getMinimum();
    float gain = (range * programVolume) + gainControl.getMinimum();
    gainControl.setValue(gain);
  </code></pre>
  
  <p>For my JSlider (which is in the method ChangeEvent e)</p>
  
  <pre><code>    programVolume =  (float)volume.getValue() / 100; 
  </code></pre>
  
  <p>I am still facing the same problem. The new values recieved from the JSlider do not change the volume. Only the initial value of programVolume alters the sound. </p>