private static void reorderList(LinkedList<Double> list) { if (GeneralTaskSettings.getSettings().getPlaytype() == PlayType.Harmonically || GeneralTaskSettings.getSettings().getMelPlayType() == PlayType.MelUp) return; if (GeneralTaskSettings.getSettings().getMelPlayType() == PlayType.MelDown) Collections.reverse(list); else Collections.shuffle(list, random); }
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; }
/** * Gets the lowest. * * @return the lowest */ private static int getLowest() { GeneralTaskSettings ps = GeneralTaskSettings.getSettings(); return random .ints(ps.getLowestPitchRange()[0], ps.getLowestPitchRange()[1]) .findAny() .getAsInt(); }
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; }
private static void createPattern(IntervalComparatorElement element) { String connector = GeneralTaskSettings.getSettings().getPlaytype() == PlayType.Harmonically ? StringConstants.HARM_CONNECTOR : StringConstants.MEL_CONNECTOR; double baseOfFirst = getLowest(); double baseOfSecond; if (IntervalComparatorSettings.getSettings().getSamePitchValue()) baseOfSecond = baseOfFirst; else baseOfSecond = getLowest(); Pattern first = createFirstPattern(element, connector, baseOfFirst); Pattern second; if (element.getFirstCompareToSecond() == 0) second = createFirstPattern(element, connector, baseOfSecond); else { second = createSecondPattern(element, connector, baseOfSecond); } if (element.getFirstCompareToSecond() > 0) element.setPatterns(new Pattern[] {second, first}); else element.setPatterns(new Pattern[] {first, second}); }