@Override
  public void extractFeatures(List regions) throws FeatureExtractorException {

    for (Region r : (List<Region>) regions) {
      if (r.hasAttribute("wav")) {
        WavData wav = (WavData) r.getAttribute("wav");
        Double epsilon = frame_size + hamming_window;
        try {
          WavData subwav = SubregionUtils.getSlice(wav, r.getStart() - epsilon, r.getEnd() + epsilon);
          if (subwav != null) {
            SpectrumExtractor extractor = new SpectrumExtractor(subwav);
            Spectrum spectrum = extractor.getSpectrum(frame_size, hamming_window);

            if (spectrum == null) {
              // AR: When writing tests, I couldn't get this case to fire. It seems unwise to remove this failsafe
              // though. If it happens during runtime, write a test for it.
              throw new AuToBIException(
                  "Tried to extract the spectrum from segment with too few frames: " + r.getDuration() + " seconds. (" +
                      subwav.getNumSamples() + " frames)");
            }
            Spectrum sub_spectrum = spectrum.getSlice(r.getStart(), r.getEnd());
            r.setAttribute(feature_name, sub_spectrum);
          }
        } catch (AuToBIException e) {
          AuToBIUtils.warn(e.getMessage());
        }
      }
    }
  }