code: public void setScale(int scale) {
          if ((scale < 1) || (scale > 256)) {
              throw new IllegalArgumentException("Scale must be between 1 and 256");
          }
          int oldScale = this.scale.getAndSet(scale);
          if (oldScale != scale) {
              repaint();
              if (!autoScroll.get()) {
                  setSize(getPreferredSize());
              }
          }
      }
docs: Set the zoom scale of the view. a value of 1 (the smallest allowed) draws the waveform at full scale.
  Larger values combine more and more segments into a single column of pixels, zooming out to see more at once.
  
  @param scale the number of waveform segments that should be averaged into a single column of pixels
  
  @throws IllegalArgumentException if scale is less than 1 or greater than 256