@Test public void shouldConvertToNoteMap() { Intervals intervalsA = new Intervals(); intervalsA.setNoteOne(new Note("DB")); intervalsA.setNoteTwo(new Note("E4")); intervalsA.setNoteThree(new Note("G#4")); intervalsA.setNoteFour(new Note("G#4")); intervalsA.setNoteFive(new Note("DB")); Intervals intervalsB = new Intervals(); intervalsB.setNoteOne(new Note("B")); intervalsB.setNoteTwo(new Note("D5")); intervalsB.setNoteThree(new Note("F#5")); intervalsB.setNoteFour(new Note("A5")); intervalsB.setNoteFive(new Note("B")); int[] arrpegio = {3, 0, 0, 0, 0, 5, 0, 3, 0, 1, 0, 3, 3, 0, 0, 0, 3, 0, 0, 0, 0, 5, 0, 3, 0, 1, 0, 3, 3, 0, 0, 0}; List<String> output = arpeggioGenerator.convertToNoteMap(arrpegio, intervalsA, intervalsB); assertThat(output).hasSize(32); assertThat(output.get(0)).isNotEqualToIgnoringCase("R"); assertThat(output.get(1)).isEqualToIgnoringCase("R"); assertThat(output.get(11)).isNotEqualToIgnoringCase("R"); assertThat(output.get(12)).isEqualToIgnoringCase("R"); assertThat(output.get(27)).isNotEqualToIgnoringCase("R"); assertThat(output.get(28)).isEqualToIgnoringCase("R"); }
public List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB) { List<String> noteMap = new ArrayList<>(); List<String> notes = JFugueConvertionUtil.getNotes(arpeggioList, intervalsA, intervalsB); List<String> filteredNotes = notes.stream().filter(n -> !n.equalsIgnoreCase("R")).collect(Collectors.toList()); int noteIndex = 0; for (int i = 0; i < arpeggioList.length; i++) { if (arpeggioList[i] != 0) { if (i > 0) { if (arpeggioList[i] != arpeggioList[i - 1]) { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } else { noteMap.add("R"); } } else { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } } else { noteMap.add("R"); } } return noteMap; }
ArpeggioGenerator implements IArpeggioGenerator { public List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB) { List<String> noteMap = new ArrayList<>(); List<String> notes = JFugueConvertionUtil.getNotes(arpeggioList, intervalsA, intervalsB); List<String> filteredNotes = notes.stream().filter(n -> !n.equalsIgnoreCase("R")).collect(Collectors.toList()); int noteIndex = 0; for (int i = 0; i < arpeggioList.length; i++) { if (arpeggioList[i] != 0) { if (i > 0) { if (arpeggioList[i] != arpeggioList[i - 1]) { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } else { noteMap.add("R"); } } else { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } } else { noteMap.add("R"); } } return noteMap; } }
ArpeggioGenerator implements IArpeggioGenerator { public List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB) { List<String> noteMap = new ArrayList<>(); List<String> notes = JFugueConvertionUtil.getNotes(arpeggioList, intervalsA, intervalsB); List<String> filteredNotes = notes.stream().filter(n -> !n.equalsIgnoreCase("R")).collect(Collectors.toList()); int noteIndex = 0; for (int i = 0; i < arpeggioList.length; i++) { if (arpeggioList[i] != 0) { if (i > 0) { if (arpeggioList[i] != arpeggioList[i - 1]) { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } else { noteMap.add("R"); } } else { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } } else { noteMap.add("R"); } } return noteMap; } @Autowired  ArpeggioGenerator(IArpeggioSelector arpeggioSelector, IMidiWeighter midiWeighter, @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes); }
ArpeggioGenerator implements IArpeggioGenerator { public List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB) { List<String> noteMap = new ArrayList<>(); List<String> notes = JFugueConvertionUtil.getNotes(arpeggioList, intervalsA, intervalsB); List<String> filteredNotes = notes.stream().filter(n -> !n.equalsIgnoreCase("R")).collect(Collectors.toList()); int noteIndex = 0; for (int i = 0; i < arpeggioList.length; i++) { if (arpeggioList[i] != 0) { if (i > 0) { if (arpeggioList[i] != arpeggioList[i - 1]) { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } else { noteMap.add("R"); } } else { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } } else { noteMap.add("R"); } } return noteMap; } @Autowired  ArpeggioGenerator(IArpeggioSelector arpeggioSelector, IMidiWeighter midiWeighter, @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes); List<Integer> generateTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType); List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB); Map<Integer, List<Arpeggio>> getArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionUnit.ProgressionType unitType, SourceData sourceData); @Override List<Arpeggio> distributeWeightedArpeggios(List<Arpeggio> weightedArpeggios); @Override Map<Integer, Arpeggio> selectFromARateDistributedList(Map<Integer, List<Arpeggio>> weightedArpeggios); @Override void weightArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, List<Arpeggio>> arpeggioMap); @Override void setPatternWithTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, Arpeggio> selectedArpeggios, SourceData sourceData, Integer bpm); }
ArpeggioGenerator implements IArpeggioGenerator { public List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB) { List<String> noteMap = new ArrayList<>(); List<String> notes = JFugueConvertionUtil.getNotes(arpeggioList, intervalsA, intervalsB); List<String> filteredNotes = notes.stream().filter(n -> !n.equalsIgnoreCase("R")).collect(Collectors.toList()); int noteIndex = 0; for (int i = 0; i < arpeggioList.length; i++) { if (arpeggioList[i] != 0) { if (i > 0) { if (arpeggioList[i] != arpeggioList[i - 1]) { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } else { noteMap.add("R"); } } else { noteMap.add(filteredNotes.get(noteIndex)); noteIndex++; } } else { noteMap.add("R"); } } return noteMap; } @Autowired  ArpeggioGenerator(IArpeggioSelector arpeggioSelector, IMidiWeighter midiWeighter, @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes); List<Integer> generateTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType); List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB); Map<Integer, List<Arpeggio>> getArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionUnit.ProgressionType unitType, SourceData sourceData); @Override List<Arpeggio> distributeWeightedArpeggios(List<Arpeggio> weightedArpeggios); @Override Map<Integer, Arpeggio> selectFromARateDistributedList(Map<Integer, List<Arpeggio>> weightedArpeggios); @Override void weightArpeggioOptions(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, List<Arpeggio>> arpeggioMap); @Override void setPatternWithTemplate(List<ProgressionUnit> progressionUnits, ProgressionType unitType, Map<Integer, Arpeggio> selectedArpeggios, SourceData sourceData, Integer bpm);  }