Skip to content

Commit

Permalink
Final cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
apmcleod committed Oct 23, 2019
1 parent 4807189 commit 0e6a008
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 39 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 0 additions & 12 deletions src/mv2h/tools/midi/NoteEventParser.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<Note> getNoteList() {
Collections.sort(completedNotes);

return completedNotes;
}

@Override
public String toString() {
Expand Down
4 changes: 2 additions & 2 deletions src/mv2h/tools/midi/Tempo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
23 changes: 4 additions & 19 deletions src/mv2h/tools/midi/TimeTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public TimeTracker() {
public TimeTracker(int subBeatLength) {
anacrusisLengthSubBeats = 0;
nodes = new LinkedList<TimeTrackerNode>();
nodes.add(new TimeTrackerNode(PPQ));
nodes.add(new TimeTrackerNode());
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<TimeTrackerNode> iterator = nodes.listIterator();

while (iterator.hasNext()) {
sb.append(iterator.next().toString()).append(',');
}

sb.deleteCharAt(sb.length() - 1);
sb.append(']');
return sb.toString();
}
}
8 changes: 3 additions & 5 deletions src/mv2h/tools/midi/TimeTrackerNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0e6a008

Please sign in to comment.