Skip to content

Commit

Permalink
notes
Browse files Browse the repository at this point in the history
  • Loading branch information
jimomulloy committed Jul 7, 2024
1 parent 9ff10c2 commit b0e70e5
Showing 1 changed file with 24 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ private void addChordNotes(NoteTrack track, NoteListElement quantizeNote, double
Set<NoteListElement> newNotes = new HashSet<>();
Set<Integer> newNoteSet = new HashSet<>();

boolean isBar = track.getSize() % synthTimeSignature == 0;
boolean isBar = false; // track.getSize() % synthTimeSignature == 0;
int barNote = track.getSize() % synthTimeSignature + 1;

int note = 0;
Expand All @@ -933,14 +933,15 @@ private void addChordNotes(NoteTrack track, NoteListElement quantizeNote, double
double quantizeEndTime = 0;
double endTime = 0;
startTime = chordListElement.getStartTime() * 1000;
double range = 100;
endTime = chordListElement.getEndTime() * 1000 + incrementTime;
if (quantizeNote != null) {
NoteListElement trackQuantizeNote = track.getQuantizeNote();
if (trackQuantizeNote == null || trackQuantizeNote.startTime < quantizeNote.startTime) {
track.setQuantizeNote(quantizeNote);
quantizeStartTime = quantizeNote.startTime;
quantizeEndTime = quantizeStartTime;
double range = quantizeNote.endTime - quantizeNote.startTime;
range = quantizeNote.endTime - quantizeNote.startTime;
quantizeEndTime += range > 0 ? range * synthChordParameters.chordMeasure
: synthChordParameters.chordMeasure * 100;
}
Expand Down Expand Up @@ -1000,59 +1001,40 @@ public int compare(ChordNote c1, ChordNote c2) {
}
}
if (synthChordParameters.chordPattern == 0) {
LOG.severe("--SYNTH0: " + time + ", " + startTime + ", " + track.number + ", " + startTime + ", "
+ quantizeNote + ", " + time);
if (!newNotes.stream()
.allMatch(nle -> currentNoteSet.contains(nle.note))) {
LOG.severe("--SYNTH0 X: " + startTime + ", " + currentNotes.length + ", " + newNotes.size());
for (NoteListElement cnle : currentNotes) {
LOG.severe("--SYNTH0 X1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
if (cnle.endTime + incrementTime >= startTime) {
cnle.endTime = startTime - incrementTime;
}
}
for (NoteListElement nnle : newNotes) {
LOG.severe("--SYNTH0 X1 ADD NOTE: " + startTime + ", " + nnle.note);
track.addNote(nnle);
// if (lastNote != null && lastNote.endTime >= startTime) {
// return;
// }
}
} else {
if (quantizeStartTime > 0) {
LOG.severe("--SYNTH0 Y: " + startTime + ", " + currentNotes.length + ", " + newNotes.size());
for (NoteListElement nnle : newNotes) {
for (NoteListElement cnle : currentNotes) {
LOG.severe("--SYNTH0 Y1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
if (lastNote != null && lastNoteEndTime >= startTime) {
if (nnle.note == cnle.note && (cnle.endTime + incrementTime >= nnle.startTime)) {
cnle.endTime = nnle.endTime;
LOG.severe("--SYNTH0 Y2 CURR NOTE: " + startTime + ", " + cnle.note + ", "
+ cnle.startTime
+ ", " + cnle.endTime);
}
} else {
if (nnle.note == cnle.note && (cnle.endTime + incrementTime >= nnle.startTime)) {
cnle.endTime = startTime - incrementTime;
LOG.severe("--SYNTH0 Y3 CURR NOTE: " + startTime + ", " + cnle.note + ", "
+ cnle.startTime
+ ", " + cnle.endTime);
}
}
}
if (lastNote != null && lastNoteEndTime < startTime) {
LOG.severe("--SYNTH0 Y1 ADD NOTE: " + startTime + ", " + nnle.note);
track.addNote(nnle);
}
}
}
}
} else if (synthChordParameters.chordPattern == 4) {
LOG.severe(">>SYNTH: " + time + ", " + startTime + ", " + track.number + ", " + startTime + ", "
+ quantizeNote + ", "
+ track.isChordPending());
if (currentNoteSet.isEmpty() && newNotes.isEmpty()) {
double lastTime = 0;
if (lastNote != null) {
Expand All @@ -1070,25 +1052,19 @@ public int compare(ChordNote c1, ChordNote c2) {
if (track.isChordPending() || !newNotes.stream()
.allMatch(nle -> currentNoteSet.contains(nle.note))) {

LOG.severe(">>SYNTH X: " + startTime + ", " + currentNotes.length + ", " + newNotes.size());
if (quantizeStartTime > 0) {
track.setChordPending(false);
for (NoteListElement nnle : newNotes) {
nnle.startTime = quantizeStartTime;
track.addNote(nnle);
LOG.severe(">>SYNTH X1 ADD NOTE: " + startTime + ", " + nnle.note);
// if (lastNote != null && lastNote.endTime >= startTime) {
// return;
// }
}
for (NoteListElement cnle : currentNotes) {
LOG.severe(">>SYNTH X1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
cnle.endTime = quantizeStartTime - incrementTime;
}
for (NoteListElement cnle : currentNotes) {
LOG.severe(">>SYNTH X1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
cnle.endTime = quantizeStartTime - incrementTime;
}
for (NoteListElement nnle : newNotes) {
Expand Down Expand Up @@ -1116,12 +1092,9 @@ public int compare(ChordNote c1, ChordNote c2) {
}
}
} else {
LOG.severe(">>SYNTH Y: " + startTime + ", " + currentNotes.length + ", " + newNotes.size());
if (quantizeStartTime > 0) {
for (NoteListElement nnle : newNotes) {
for (NoteListElement cnle : currentNotes) {
LOG.severe(">>SYNTH Y1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
if (lastNote != null && lastNoteEndTime >= startTime) {
if (nnle.note == cnle.note && (cnle.endTime + incrementTime >= nnle.startTime)) {
cnle.endTime = nnle.endTime;
Expand All @@ -1133,17 +1106,12 @@ public int compare(ChordNote c1, ChordNote c2) {
}
}
if (lastNote != null && lastNoteEndTime < startTime) {
LOG.severe(">>SYNTH Y1 ADD NOTE: " + startTime + ", " + nnle.note);
track.addNote(nnle);
}
}
} else {
for (NoteListElement cnle : currentNotes) {
LOG.severe(">>SYNTH Z1 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime);
cnle.endTime = endTime; // - incrementTime;// + incrementTime;
LOG.severe(">>SYNTH Z2 CURR NOTE: " + startTime + ", " + cnle.note + ", " + cnle.startTime
+ ", " + cnle.endTime + ", " + cnle.avgAmp + ", " + cnle);
}
}
}
Expand Down Expand Up @@ -1203,9 +1171,11 @@ public int compare(ChordNote c1, ChordNote c2) {
}
} else {
for (int i = 0; i < cnotes.size() - 1; i++) {
if (cnotes.get(i) == lastNote.note) {
noteIndex = i + 1;
break;
if (lastNote != null) {
if (cnotes.get(i) == lastNote.note) {
noteIndex = i + 1;
break;
}
}
}
}
Expand All @@ -1214,13 +1184,22 @@ public int compare(ChordNote c1, ChordNote c2) {
}
}

NoteListElement chordNote = new NoteListElement(note, pitchSet.getIndex(note), startTime, endTime, 0, 0,
amplitude, amplitude, amplitude, 0, false, incrementTime);
track.addNote(chordNote);
LOG.finer(
">>NT added chord arp note: " + time + ", " + chordNote.startTime + ", " + chordNote.endTime + ", "
+ note + ", " + track.getSize() + ", " + synthTimeSignature + ", " + startTime + ", "
+ endTime);
if (lastNote != null && lastNote.note == note) {
lastNote.endTime = endTime;
} else {
if (lastNote != null) {
lastNote.endTime = startTime - incrementTime;
;
}
NoteListElement chordNote = new NoteListElement(note, pitchSet.getIndex(note), startTime, endTime, 0, 0,
amplitude, amplitude, amplitude, 0, false, incrementTime);
track.addNote(chordNote);
LOG.finer(
">>NT added chord arp note: " + time + ", " + chordNote.startTime + ", " + chordNote.endTime
+ ", "
+ note + ", " + track.getSize() + ", " + synthTimeSignature + ", " + startTime + ", "
+ endTime);
}
}
}

Expand Down

0 comments on commit b0e70e5

Please sign in to comment.