@Test public void shouldSetAlternatingWholeNotesForMidPattern(){ synthPadGenerator.generateAndSetSynthPad(progressionUnitVerse, selectedCompOptions); Assert.assertNotNull(progressionUnitVerse.getProgressionUnitBars()); Assert.assertTrue(progressionUnitVerse.getProgressionUnitBars().size() > 0); boolean foundMatch = false; for (String noteName : getNotes("cmaj")) { if(!foundMatch) { foundMatch = progressionUnitVerse.getProgressionUnitBars().get(0).getPatternMid().toString().contains(noteName); } } assertThat(foundMatch).isTrue(); foundMatch = false; for (String noteName : getNotes("dmin")) { if(!foundMatch) { foundMatch = progressionUnitVerse.getProgressionUnitBars().get(0).getPatternMid().toString().contains(noteName); } } assertThat(foundMatch).isTrue(); assertThat(progressionUnitVerse.getProgressionUnitBars().get(1).getPatternMid().toString()).isEmpty(); foundMatch = false; for (String noteName : getNotes("f#maj")) { if(!foundMatch) { foundMatch = progressionUnitVerse.getProgressionUnitBars().get(2).getPatternMid().toString().contains(noteName); } } assertThat(foundMatch).isTrue(); foundMatch = false; for (String noteName : getNotes("g#maj")) { if(!foundMatch) { foundMatch = progressionUnitVerse.getProgressionUnitBars().get(2).getPatternMid().toString().contains(noteName); } } assertThat(foundMatch).isTrue(); assertThat(progressionUnitVerse.getProgressionUnitBars().get(3).getPatternMid().toString()).isEmpty(); }
public ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions) { boolean skipBar = false; for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(!skipBar) { String chordNameOne = progressionUnit.getProgressionUnitBars().get(i).getjChord().toString(); String chordNameTwo = progressionUnit.getProgressionUnitBars().get(i+1).getjChord().toString(); if (chordNameOne.indexOf("4") == 1 || chordNameOne.indexOf("4") == 2) { chordNameOne = chordNameOne.replace("4", "5"); } if (chordNameTwo.indexOf("4") == 1 || chordNameTwo.indexOf("4") == 2) { chordNameTwo = chordNameTwo.replace("4", "5"); } String jFugueString = ""; jFugueString = chordNameOne + "w " + chordNameTwo + "w "; for(int t=0; t<numOfGeneratedMixes; t++) { if(t >= progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().size()){ progressionUnit.getProgressionUnitBars().get(i).getPatternMid().add(new Pattern()); progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().add(new Pattern()); } progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().get(t).add(jFugueString); progressionUnit.getProgressionUnitBars().get(i).getPatternMid().get(t).add(jFugueString); } } skipBar = !skipBar; } return progressionUnit; }
SynthPadGenerator implements ISynthPadGenerator { public ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions) { boolean skipBar = false; for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(!skipBar) { String chordNameOne = progressionUnit.getProgressionUnitBars().get(i).getjChord().toString(); String chordNameTwo = progressionUnit.getProgressionUnitBars().get(i+1).getjChord().toString(); if (chordNameOne.indexOf("4") == 1 || chordNameOne.indexOf("4") == 2) { chordNameOne = chordNameOne.replace("4", "5"); } if (chordNameTwo.indexOf("4") == 1 || chordNameTwo.indexOf("4") == 2) { chordNameTwo = chordNameTwo.replace("4", "5"); } String jFugueString = ""; jFugueString = chordNameOne + "w " + chordNameTwo + "w "; for(int t=0; t<numOfGeneratedMixes; t++) { if(t >= progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().size()){ progressionUnit.getProgressionUnitBars().get(i).getPatternMid().add(new Pattern()); progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().add(new Pattern()); } progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().get(t).add(jFugueString); progressionUnit.getProgressionUnitBars().get(i).getPatternMid().get(t).add(jFugueString); } } skipBar = !skipBar; } return progressionUnit; } }
SynthPadGenerator implements ISynthPadGenerator { public ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions) { boolean skipBar = false; for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(!skipBar) { String chordNameOne = progressionUnit.getProgressionUnitBars().get(i).getjChord().toString(); String chordNameTwo = progressionUnit.getProgressionUnitBars().get(i+1).getjChord().toString(); if (chordNameOne.indexOf("4") == 1 || chordNameOne.indexOf("4") == 2) { chordNameOne = chordNameOne.replace("4", "5"); } if (chordNameTwo.indexOf("4") == 1 || chordNameTwo.indexOf("4") == 2) { chordNameTwo = chordNameTwo.replace("4", "5"); } String jFugueString = ""; jFugueString = chordNameOne + "w " + chordNameTwo + "w "; for(int t=0; t<numOfGeneratedMixes; t++) { if(t >= progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().size()){ progressionUnit.getProgressionUnitBars().get(i).getPatternMid().add(new Pattern()); progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().add(new Pattern()); } progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().get(t).add(jFugueString); progressionUnit.getProgressionUnitBars().get(i).getPatternMid().get(t).add(jFugueString); } } skipBar = !skipBar; } return progressionUnit; }  }
SynthPadGenerator implements ISynthPadGenerator { public ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions) { boolean skipBar = false; for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(!skipBar) { String chordNameOne = progressionUnit.getProgressionUnitBars().get(i).getjChord().toString(); String chordNameTwo = progressionUnit.getProgressionUnitBars().get(i+1).getjChord().toString(); if (chordNameOne.indexOf("4") == 1 || chordNameOne.indexOf("4") == 2) { chordNameOne = chordNameOne.replace("4", "5"); } if (chordNameTwo.indexOf("4") == 1 || chordNameTwo.indexOf("4") == 2) { chordNameTwo = chordNameTwo.replace("4", "5"); } String jFugueString = ""; jFugueString = chordNameOne + "w " + chordNameTwo + "w "; for(int t=0; t<numOfGeneratedMixes; t++) { if(t >= progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().size()){ progressionUnit.getProgressionUnitBars().get(i).getPatternMid().add(new Pattern()); progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().add(new Pattern()); } progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().get(t).add(jFugueString); progressionUnit.getProgressionUnitBars().get(i).getPatternMid().get(t).add(jFugueString); } } skipBar = !skipBar; } return progressionUnit; }  ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions); String selectChordNote(Note[] notes); int randomIndex(); }
SynthPadGenerator implements ISynthPadGenerator { public ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions) { boolean skipBar = false; for(int i=0; i<progressionUnit.getProgressionUnitBars().size(); i++){ if(!skipBar) { String chordNameOne = progressionUnit.getProgressionUnitBars().get(i).getjChord().toString(); String chordNameTwo = progressionUnit.getProgressionUnitBars().get(i+1).getjChord().toString(); if (chordNameOne.indexOf("4") == 1 || chordNameOne.indexOf("4") == 2) { chordNameOne = chordNameOne.replace("4", "5"); } if (chordNameTwo.indexOf("4") == 1 || chordNameTwo.indexOf("4") == 2) { chordNameTwo = chordNameTwo.replace("4", "5"); } String jFugueString = ""; jFugueString = chordNameOne + "w " + chordNameTwo + "w "; for(int t=0; t<numOfGeneratedMixes; t++) { if(t >= progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().size()){ progressionUnit.getProgressionUnitBars().get(i).getPatternMid().add(new Pattern()); progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().add(new Pattern()); } progressionUnit.getProgressionUnitBars().get(i).getPatternMidAlt().get(t).add(jFugueString); progressionUnit.getProgressionUnitBars().get(i).getPatternMid().get(t).add(jFugueString); } } skipBar = !skipBar; } return progressionUnit; }  ProgressionUnit generateAndSetSynthPad(ProgressionUnit progressionUnit, Map<ProgressionUnit.ProgressionType, CompRhythm> selectedCompOptions); String selectChordNote(Note[] notes); int randomIndex();  }