/** * Creates the pattern for new chord. * * @param newStructure the new structure * @return the linked list */ public static LinkedList<Pattern> createPatternForNewChord(List<Interval> newStructure) { LinkedList<Pattern> patterns = new LinkedList<>(); Interval array[] = new Interval[newStructure.size()]; String melPattern = createPatternForStructureNoAccelerator( newStructure.toArray(array), StringConstants.MEL_CONNECTOR, 60); String harmPattern = createPatternForStructureNoAccelerator( newStructure.toArray(array), StringConstants.HARM_CONNECTOR, 60); Pattern p = new Pattern(melPattern); p.setInstrument(1); patterns.add(p); Pattern p2 = new Pattern(harmPattern); p2.setInstrument(2); patterns.add(p2); return patterns; }
private static Pattern createFirstPattern( IntervalComparatorElement element, String connector, double baseFreq) { String pat = createPatternForInterval(element.getInterval(), connector, baseFreq); Pattern p = new Pattern(pat); p.setInstrument(GeneralTaskSettings.getSettings().getInstrumentIndex()); p.setTempo(GeneralTaskSettings.getSettings().getTempo()); return p; }
private static Pattern createSecondPattern( IntervalComparatorElement element, String connector, double baseOfSecond) { double higherFreq = calculateHigherFreq(baseOfSecond, element.getInterval().getJfugueRep(), element.getRatio()); String pat = buildPattern(Note.getFrequencyForNote((int) baseOfSecond), higherFreq, connector); Pattern p = new Pattern(pat); p.setInstrument(GeneralTaskSettings.getSettings().getInstrumentIndex()); p.setTempo(GeneralTaskSettings.getSettings().getTempo()); return p; }
/** * Creates the patterns for chords. * * @param structures the structures * @return the linked list */ public static LinkedList<Pattern> createPatternsForChords(LinkedList<CustomChord> structures) { LinkedList<Pattern> patterns = new LinkedList<>(); String connector = GeneralTaskSettings.getSettings().getPlaytype() == PlayType.Harmonically ? StringConstants.HARM_CONNECTOR : StringConstants.MEL_CONNECTOR; structures.forEach( struct -> { String pat = createChordPattern(generateMidis(struct), connector); if (pat == null) throw new PatternCreationException("Method createPatternForStructure failed"); Pattern p = new Pattern(pat); p.setInstrument(GeneralTaskSettings.getSettings().getInstrumentIndex()); p.setTempo(GeneralTaskSettings.getSettings().getTempo()); patterns.add(p); }); return patterns; }