From 0e6a008e4247a4ed33406ad5320290e3071b691a Mon Sep 17 00:00:00 2001 From: Andrew McLeod Date: Wed, 23 Oct 2019 11:47:53 +0900 Subject: [PATCH] Final cleanup --- README.md | 2 +- src/mv2h/tools/midi/NoteEventParser.java | 12 ------------ src/mv2h/tools/midi/Tempo.java | 4 ++-- src/mv2h/tools/midi/TimeTracker.java | 23 ++++------------------- src/mv2h/tools/midi/TimeTrackerNode.java | 8 +++----- 5 files changed, 10 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 0c6988e..19477c7 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Chord symbols will not be parsed. ##### Additional Args * `-a INT` = Set an anacrusis (pick-up bar) length of INT sub beats. -* `-T` = Use tracks as ground truth voices rather than channels. +* `-t` = Use tracks as ground truth voices rather than channels. ### Averaging Multiple Evaluations To get the averages of many MV2H evaluations: diff --git a/src/mv2h/tools/midi/NoteEventParser.java b/src/mv2h/tools/midi/NoteEventParser.java index b64574f..eecb431 100644 --- a/src/mv2h/tools/midi/NoteEventParser.java +++ b/src/mv2h/tools/midi/NoteEventParser.java @@ -1,7 +1,6 @@ package mv2h.tools.midi; import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -89,17 +88,6 @@ public void noteOff(int key, long tick, int channel) throws InvalidMidiDataExcep throw new InvalidMidiDataException("Note off event doesn't match any note on: " + "pitch=" + key + ", tick=" + tick + " voice=" + channel); } - - /** - * Returns a list of the notes present in this song, in time order. - * - * @return A list of the notes present as described above. - */ - public List getNoteList() { - Collections.sort(completedNotes); - - return completedNotes; - } @Override public String toString() { diff --git a/src/mv2h/tools/midi/Tempo.java b/src/mv2h/tools/midi/Tempo.java index 2b4544b..62bff5d 100644 --- a/src/mv2h/tools/midi/Tempo.java +++ b/src/mv2h/tools/midi/Tempo.java @@ -30,9 +30,9 @@ public Tempo(byte[] data) { } /** - * Gets the number of milliseconds which pass per quarter note. + * Gets the number of milliseconds per quarter note at this tempo. * - * @return {@link #microSecondsPerQuarter} + * @return {@link #microSecondsPerQuarter} converted to milliseconds. */ public double getMillisPerQuarter() { return microSecondsPerQuarter / 1000.0; diff --git a/src/mv2h/tools/midi/TimeTracker.java b/src/mv2h/tools/midi/TimeTracker.java index 4947526..3a0978a 100644 --- a/src/mv2h/tools/midi/TimeTracker.java +++ b/src/mv2h/tools/midi/TimeTracker.java @@ -56,7 +56,7 @@ public TimeTracker() { public TimeTracker(int subBeatLength) { anacrusisLengthSubBeats = 0; nodes = new LinkedList(); - nodes.add(new TimeTrackerNode(PPQ)); + nodes.add(new TimeTrackerNode()); } /** @@ -136,10 +136,10 @@ public void addKeyChange(MidiEvent event, MetaMessage mm) { } /** - * Returns the time in microseconds of a given tick number. + * Returns the time in milliseconds at a given tick. * - * @param tick The tick number to calculate the time of - * @return The time of the given tick number, measured in microseconds since the most recent epoch. + * @param tick The tick number to calculate the time of. + * @return The time of the given tick number, measured in milliseconds since time 0. */ public double getTimeAtTick(long tick) { return getNodeAtTick(tick).getTimeAtTick(tick, PPQ); @@ -275,19 +275,4 @@ public void setLastTick(long lastTick) { public void setPPQ(double ppq) { PPQ = ppq; } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder("["); - - ListIterator iterator = nodes.listIterator(); - - while (iterator.hasNext()) { - sb.append(iterator.next().toString()).append(','); - } - - sb.deleteCharAt(sb.length() - 1); - sb.append(']'); - return sb.toString(); - } } diff --git a/src/mv2h/tools/midi/TimeTrackerNode.java b/src/mv2h/tools/midi/TimeTrackerNode.java index 4088ee1..6da594a 100644 --- a/src/mv2h/tools/midi/TimeTrackerNode.java +++ b/src/mv2h/tools/midi/TimeTrackerNode.java @@ -48,10 +48,8 @@ public class TimeTrackerNode { /** * Create a new dummy first TimeTrackerNode at tick and time 0. - * - * @param ppq The pulses per quarter note of the song. */ - public TimeTrackerNode(double ppq) { + public TimeTrackerNode() { startTick = 0L; isTimeSignatureDummy = true; @@ -191,9 +189,9 @@ public Key getKey() { } /** - * Get the number of microseconds per sub beat. + * Get the number of milliseconds per sub beat. * - * @return Microseconds per sub beat. + * @return Milliseconds per sub beat. */ private double getMillisPerSubBeat() { return tempo.getMillisPerQuarter() / timeSignature.getSubBeatsPerQuarter();