@Test public void shouldIncreaseVolumeWhenNormalizeAudioIsCalled() throws InterruptedException, IOException { double initialVolume = audioUtils.getMaxVolume(new File(originalAudioPath)); normalizeAudio.normalizeMix(appConfigs.getMockDataAudioDir(), "normalize_test_copy", 1); double finalVolume = audioUtils.getMaxVolume(new File(copiedAudioPath.replace(".mp3", "_0_1.mp3"))); assertThat(finalVolume).isGreaterThan(initialVolume); assertThat(finalVolume).isLessThanOrEqualTo(0.0); boolean hasBeenDeleted = Files.notExists(new File(Paths.get(appConfigs.getMockDataAudioDir(),"normalize_test_copy_0_1_processing.mp3").toString()).toPath()); assertThat(hasBeenDeleted).isTrue(); }
public void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes) throws InterruptedException, IOException { int numberOfTrackVariations = 3; for (int i = 0; i < numOfGeneratedMixes; i++) { for(int k=1; k<numOfAltMelodies + 1; k++) { String mixFileNameProcessing = mixFileName + "_" + i + "_" + k + "_processing.mp3"; String mixFileNameCopy = mixFileName + "_" + i + "_" + k + ".mp3"; performNormalize(mixFilePath, mixFileNameProcessing, mixFileNameCopy); } } }
NormalizeAudio { public void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes) throws InterruptedException, IOException { int numberOfTrackVariations = 3; for (int i = 0; i < numOfGeneratedMixes; i++) { for(int k=1; k<numOfAltMelodies + 1; k++) { String mixFileNameProcessing = mixFileName + "_" + i + "_" + k + "_processing.mp3"; String mixFileNameCopy = mixFileName + "_" + i + "_" + k + ".mp3"; performNormalize(mixFilePath, mixFileNameProcessing, mixFileNameCopy); } } } }
NormalizeAudio { public void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes) throws InterruptedException, IOException { int numberOfTrackVariations = 3; for (int i = 0; i < numOfGeneratedMixes; i++) { for(int k=1; k<numOfAltMelodies + 1; k++) { String mixFileNameProcessing = mixFileName + "_" + i + "_" + k + "_processing.mp3"; String mixFileNameCopy = mixFileName + "_" + i + "_" + k + ".mp3"; performNormalize(mixFilePath, mixFileNameProcessing, mixFileNameCopy); } } }  }
NormalizeAudio { public void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes) throws InterruptedException, IOException { int numberOfTrackVariations = 3; for (int i = 0; i < numOfGeneratedMixes; i++) { for(int k=1; k<numOfAltMelodies + 1; k++) { String mixFileNameProcessing = mixFileName + "_" + i + "_" + k + "_processing.mp3"; String mixFileNameCopy = mixFileName + "_" + i + "_" + k + ".mp3"; performNormalize(mixFilePath, mixFileNameProcessing, mixFileNameCopy); } } }  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 void normalizeMix(String mixFilePath, String mixFileName, int numOfGeneratedMixes) throws InterruptedException, IOException { int numberOfTrackVariations = 3; for (int i = 0; i < numOfGeneratedMixes; i++) { for(int k=1; k<numOfAltMelodies + 1; k++) { String mixFileNameProcessing = mixFileName + "_" + i + "_" + k + "_processing.mp3"; String mixFileNameCopy = mixFileName + "_" + i + "_" + k + ".mp3"; performNormalize(mixFilePath, mixFileNameProcessing, mixFileNameCopy); } } }  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; }