@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 = synthBassGenerator.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; }
SynthBassOptions implements ISynthBassGenerator { 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; } }
SynthBassOptions implements ISynthBassGenerator { 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  SynthBassOptions(IBasslineWeighter basslineWeighter,
                            @Value("${bypass_bassline_vertical_rating}") boolean bypassBasslineVerticalRating,
                            @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes
    ); }
SynthBassOptions implements ISynthBassGenerator { 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  SynthBassOptions(IBasslineWeighter basslineWeighter,
                            @Value("${bypass_bassline_vertical_rating}") boolean bypassBasslineVerticalRating,
                            @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes
    ); void generateSynthBassOptions(ProgressionUnit progressionUnit, List<Bassline> basslines, HashMap<Integer, List<BasslineWithRating>> basslineMap); @Override List<BasslineWithRating> distributeByWeights(List<BasslineWithRating> basslineWithRatings); @Override void setSynthBassOptions(ProgressionUnit progressionUnit, List<Bassline> basslines, HashMap<Integer, List<BasslineWithRating>> basslineMap, Integer bpm); int getBassCode(Chord chordOne, Chord chordTwo, int bassOctave); void populateBasslinesByCode(List<Bassline> basslineSource, int bassCode, HashMap<Integer, List<BasslineWithRating>> basslineMap); int[] generateBeatArrayFromBassline(Bassline bassline); Pattern generateBasslinePattern(Intervals intervalsA, Intervals intervalsB, int[] beats, int bassOctave, Integer bpm); List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB); @Override String transposeChord(String chord, int bassOctave); }
SynthBassOptions implements ISynthBassGenerator { 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  SynthBassOptions(IBasslineWeighter basslineWeighter,
                            @Value("${bypass_bassline_vertical_rating}") boolean bypassBasslineVerticalRating,
                            @Value("${num_of_generated_mixes}") Integer numOfGeneratedMixes
    ); void generateSynthBassOptions(ProgressionUnit progressionUnit, List<Bassline> basslines, HashMap<Integer, List<BasslineWithRating>> basslineMap); @Override List<BasslineWithRating> distributeByWeights(List<BasslineWithRating> basslineWithRatings); @Override void setSynthBassOptions(ProgressionUnit progressionUnit, List<Bassline> basslines, HashMap<Integer, List<BasslineWithRating>> basslineMap, Integer bpm); int getBassCode(Chord chordOne, Chord chordTwo, int bassOctave); void populateBasslinesByCode(List<Bassline> basslineSource, int bassCode, HashMap<Integer, List<BasslineWithRating>> basslineMap); int[] generateBeatArrayFromBassline(Bassline bassline); Pattern generateBasslinePattern(Intervals intervalsA, Intervals intervalsB, int[] beats, int bassOctave, Integer bpm); List<String> convertToNoteMap(int[] arpeggioList, Intervals intervalsA, Intervals intervalsB); @Override String transposeChord(String chord, int bassOctave); static final int BASS_OCTAVE; }