code: @SuppressWarnings("WeakerAccess")
      public Color segmentColor(final int segment, final int scale) {
          final ByteBuffer waveBytes = getData();
          final int limit = getFrameCount();
          if (isColor) {
              int red = 0;
              int green = 0;
              int blue = 0;
              for (int i = segment; (i < segment + scale) && (i < limit); i++) {
                  int bits = getColorWaveformBits(waveBytes, segment);
                  red += (bits >> 13) & 7;
                  green += (bits >> 10) & 7;
                  blue += (bits >> 7) & 7;
              }
              return new Color(red * 255 / (scale * 7), blue * 255 / (scale * 7), green * 255 / (scale * 7));
          }
          int sum = 0;
          for (int i = segment; (i < segment + scale) && (i < limit); i++) {
              sum += (waveBytes.get(i) & 0xe0) >> 5;
          }
          return COLOR_MAP[sum / scale];
      }
docs: Determine the color of the waveform given an index into it. If {@code scale} is larger than 1 we are zoomed out,
  so we determine an average color 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 the color of the waveform at that segment, which may be based on an average
  of a number of values starting there, determined by the scale