title: How to change MidiChannel volume?
body: <p>iam trying to change the midi vol using this func</p>
  <pre><code>public static void setVolume(int value) {
      int CHANGE_VOLUME = 7;
      midivol = value;
      try {
          if (synthesizer.getDefaultSoundbank() == null) {
                  ShortMessage volumeMessage = new ShortMessage();
                  for (int i = 0; i &lt; 16; i++) {
                      volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midivol);
                      volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midivol);
                      MidiSystem.getReceiver().send(volumeMessage, -1);
                  }
          } else {
              MidiChannel[] channels = synthesizer.getChannels();
              for (int c = 0; channels != null &amp;&amp; c &lt; channels.length; c++) {
                  channels[c].controlChange(CHANGE_VOLUME, midivol);
                  channels[c].controlChange(39, midivol);
              }
          }
      } catch (Exception e) {
              e.printStackTrace();
          }
  }
  </code></pre>
  <p>and it wont change so iam asking what is the problem there and what is the range for the value is it from 0-127?</p>
  <p>and why there is two of volumemessage and channels[c]</p>
  <pre><code>volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, CHANGE_VOLUME, midivol);
                  volumeMessage.setMessage(ShortMessage.CONTROL_CHANGE, i, 39, midivol);
  
  channels[c].controlChange(CHANGE_VOLUME, midivol);
              channels[c].controlChange(39, midivol);
  </code></pre>