code: @SuppressWarnings("WeakerAccess")
      public int segmentHeight(final int segment, final int scale) {
          final ByteBuffer waveBytes = getData();
          final int limit = getFrameCount();
          int sum = 0;
          for (int i = segment; (i < segment + scale) && (i < limit); i++) {
              if (isColor) {
                  sum += (getColorWaveformBits(waveBytes, segment) >> 2) & 0x1f;
              } else {
                  sum += waveBytes.get(i) & 0x1f;
              }
          }
          return sum / scale;
      }
docs: Determine the height of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out,
  so we determine an average height of {@code scale} segments starting with the specified one.
  
  @param segment the index of the first waveform byte to examine
  @param scale the number of wave segments being drawn as a single pixel column
  
  @return a value from 0 to 31 representing the height of the waveform at that segment, which may be an average
  of a number of values starting there, determined by the scale