@Test public void shouldExtractHarmoniesAtIndexFromTwoBarLoop() { setupTwoBarExample(); int noteIndex = 4; HarmonyExtraction extraction = melodicExtractor.extractedAndSetHarmony(progressionUnitBar, noteIndex); assertThat(extraction.getChordname()).isEqualToIgnoringCase("cmaj7"); assertThat(extraction.getHarmonies()).isEqualTo(Arrays.asList("L", "H", "C","D")); }
public QueueState extractedAndSetHarmony(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for (int i = 0; i < pUnit.getProgressionUnitBars().size(); i++) { List<HarmonyExtraction> extractions = createHarmonicExtractionForBar(pUnit.getProgressionUnitBars().get(i)); pUnit.getProgressionUnitBars().get(i).setHarmonicExtractions(extractions); } } return queueState; }
MelodicExtractor { public QueueState extractedAndSetHarmony(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for (int i = 0; i < pUnit.getProgressionUnitBars().size(); i++) { List<HarmonyExtraction> extractions = createHarmonicExtractionForBar(pUnit.getProgressionUnitBars().get(i)); pUnit.getProgressionUnitBars().get(i).setHarmonicExtractions(extractions); } } return queueState; } }
MelodicExtractor { public QueueState extractedAndSetHarmony(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for (int i = 0; i < pUnit.getProgressionUnitBars().size(); i++) { List<HarmonyExtraction> extractions = createHarmonicExtractionForBar(pUnit.getProgressionUnitBars().get(i)); pUnit.getProgressionUnitBars().get(i).setHarmonicExtractions(extractions); } } return queueState; }  }
MelodicExtractor { public QueueState extractedAndSetHarmony(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for (int i = 0; i < pUnit.getProgressionUnitBars().size(); i++) { List<HarmonyExtraction> extractions = createHarmonicExtractionForBar(pUnit.getProgressionUnitBars().get(i)); pUnit.getProgressionUnitBars().get(i).setHarmonicExtractions(extractions); } } return queueState; }  QueueState extractedAndSetHarmony(QueueState queueState); List<HarmonyExtraction> createHarmonicExtractionForBar(ProgressionUnitBar progressionUnitBar); HarmonyExtraction extractedAndSetHarmony(ProgressionUnitBar progressionUnitBar, int noteIndex); int getCurrentBarIndex(int barCount, int currentBar, int index); }
MelodicExtractor { public QueueState extractedAndSetHarmony(QueueState queueState) { for (ProgressionUnit pUnit : queueState.getStructure()) { for (int i = 0; i < pUnit.getProgressionUnitBars().size(); i++) { List<HarmonyExtraction> extractions = createHarmonicExtractionForBar(pUnit.getProgressionUnitBars().get(i)); pUnit.getProgressionUnitBars().get(i).setHarmonicExtractions(extractions); } } return queueState; }  QueueState extractedAndSetHarmony(QueueState queueState); List<HarmonyExtraction> createHarmonicExtractionForBar(ProgressionUnitBar progressionUnitBar); HarmonyExtraction extractedAndSetHarmony(ProgressionUnitBar progressionUnitBar, int noteIndex); int getCurrentBarIndex(int barCount, int currentBar, int index);  }