/** * Creates the pattern for structure no acc. * * @param structure the structure * @param connector the connector * @param lowestPitch the lowest pitch * @return the string */ private static String createPatternForStructureNoAccelerator( Interval[] structure, String connector, int lowestPitch) { if (structure == null) return null; StringBuilder sb = new StringBuilder(); sb.append(lowestPitch + StringConstants.QUARTER); sb.append(connector); for (Interval interval : structure) { sb.append(lowestPitch + interval.getJfugueRep()); sb.append(StringConstants.QUARTER); sb.append(connector); } sb.deleteCharAt(sb.length() - 1); return sb.toString(); }
/** * Generate midis. * * @param struct the struct * @return the linked list */ private static LinkedList<Double> generateMidis(CustomChord struct) { LinkedList<Double> values = new LinkedList<>(); int prime = getLowest(); values.add((double) prime); for (Interval in : struct.getStructure()) { values.add((double) (prime + in.getJfugueRep())); } if (struct.hasInversions()) { for (int i = 0; i < struct.getInversion().getIndex(); i++) { values.set(i, values.get(i) + 12); } } Collections.sort(values); double shift = prime - values.get(0); for (int i = 0; i < values.size(); i++) values.set(i, values.get(i) + shift); return values; }
/** * Creates the pattern for structure. * * @param structure the structure * @param connector the connector * @param lowestPitch the lowest pitch * @return the string */ private static String createPatternForInterval( Interval structure, String connector, double lowestPitch) { if (structure == null) return null; LinkedList<Double> list = new LinkedList<>(); list.add(lowestPitch); list.add(lowestPitch + structure.getJfugueRep()); reorderList(list); StringBuilder sb = new StringBuilder(); sb.append((int) (double) list.get(0)); sb.append(StringConstants.QUARTER); sb.append(connector); sb.append((int) (double) list.get(1)); sb.append(StringConstants.QUARTER); sb.append(connector); sb.deleteCharAt(sb.length() - 1); return sb.toString(); }