@Test public void shouldReturnFalseWhenNotInRange(){ HashMap<Path, Double> means = new HashMap<>(); means.put(new File("a").toPath(), 0.435); means.put(new File("b").toPath(), -13.435); means.put(new File("c").toPath(), -25.435); means.put(new File("d").toPath(), 0.135); Double target = -8.6; boolean withinRange = normalizeAudio.meansWithinTargetRange(target, means); assertThat(withinRange).isFalse(); }
public boolean meansWithinTargetRange(Double target, Map<Path, Double> means) { for (Map.Entry<Path, Double> entry : means.entrySet()) { Double unRoundedNumberOffset = target - entry.getValue(); Double roundedNumberOffset = (double) Math.round(unRoundedNumberOffset * 10) / 10; if (Math.abs(roundedNumberOffset) > TARGET_RANGE) { return false; } } return true; }
NormalizeAudio { public boolean meansWithinTargetRange(Double target, Map<Path, Double> means) { for (Map.Entry<Path, Double> entry : means.entrySet()) { Double unRoundedNumberOffset = target - entry.getValue(); Double roundedNumberOffset = (double) Math.round(unRoundedNumberOffset * 10) / 10; if (Math.abs(roundedNumberOffset) > TARGET_RANGE) { return false; } } return true; } }
NormalizeAudio { public boolean meansWithinTargetRange(Double target, Map<Path, Double> means) { for (Map.Entry<Path, Double> entry : means.entrySet()) { Double unRoundedNumberOffset = target - entry.getValue(); Double roundedNumberOffset = (double) Math.round(unRoundedNumberOffset * 10) / 10; if (Math.abs(roundedNumberOffset) > TARGET_RANGE) { return false; } } return true; }  }
NormalizeAudio { public boolean meansWithinTargetRange(Double target, Map<Path, Double> means) { for (Map.Entry<Path, Double> entry : means.entrySet()) { Double unRoundedNumberOffset = target - entry.getValue(); Double roundedNumberOffset = (double) Math.round(unRoundedNumberOffset * 10) / 10; if (Math.abs(roundedNumberOffset) > TARGET_RANGE) { return false; } } return true; }  double normalizeLoopFiles(String directory); double normalizeFilesInADirectory(String directory); void cleanup(String directoryPath); List<Path> renameToProcessing(String directoryPath); List<Path> getWavPathsFromDirectory(String directoryPath); List<Path> getProcessingPathsFromWavPaths(List<Path> wavPaths); Map<Path, Double> renameToProcessing(Map<Path, Double> wavPaths, List<Path> alreadyRenamed); HashMap<Path, Double> createMeanVolumeMap(List<Path> paths); void normalize(Map<Path, Double> meanVolumeMap, double targetMean, String directory); void normalizeToTarget(Map<Path, Double> meandddOffSets, List<Path> alreadyAdjusted, List<Path> alreadyRenamed); Double getMeanOfMeans(Map<Path, Double> meanVolumeMap); HashMap<Path, Double> calculateMeanOffset(Double target, Map<Path, Double> meanVolumeMap); boolean meansWithinTargetRange(Double target, Map<Path, Double> means); boolean meanIsWithinTargetRange(Double target, Double mean); void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes); }
NormalizeAudio { public boolean meansWithinTargetRange(Double target, Map<Path, Double> means) { for (Map.Entry<Path, Double> entry : means.entrySet()) { Double unRoundedNumberOffset = target - entry.getValue(); Double roundedNumberOffset = (double) Math.round(unRoundedNumberOffset * 10) / 10; if (Math.abs(roundedNumberOffset) > TARGET_RANGE) { return false; } } return true; }  double normalizeLoopFiles(String directory); double normalizeFilesInADirectory(String directory); void cleanup(String directoryPath); List<Path> renameToProcessing(String directoryPath); List<Path> getWavPathsFromDirectory(String directoryPath); List<Path> getProcessingPathsFromWavPaths(List<Path> wavPaths); Map<Path, Double> renameToProcessing(Map<Path, Double> wavPaths, List<Path> alreadyRenamed); HashMap<Path, Double> createMeanVolumeMap(List<Path> paths); void normalize(Map<Path, Double> meanVolumeMap, double targetMean, String directory); void normalizeToTarget(Map<Path, Double> meandddOffSets, List<Path> alreadyAdjusted, List<Path> alreadyRenamed); Double getMeanOfMeans(Map<Path, Double> meanVolumeMap); HashMap<Path, Double> calculateMeanOffset(Double target, Map<Path, Double> meanVolumeMap); boolean meansWithinTargetRange(Double target, Map<Path, Double> means); boolean meanIsWithinTargetRange(Double target, Double mean); void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes); @Autowired
    public AppConfigs appConfigs; }