Skip to content

Commit

Permalink
Merge pull request #5 from apmcleod/midi
Browse files Browse the repository at this point in the history
Implements MIDI to mv2h conversion functionality.
  • Loading branch information
apmcleod committed Oct 23, 2019
2 parents 4e9ce32 + 0e6a008 commit 5f8d051
Show file tree
Hide file tree
Showing 12 changed files with 1,762 additions and 422 deletions.
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,29 @@ To evaluate a time-aligned transcription and ground truth:
(The C++ converter must be compiled first using `./compile.sh` in the `MusicXMLParser` directory.)

2. Convert that text-based format into the MV2H format:
`java -cp bin mv2h.tools.Converter <gt_xml.txt >gt_converted.txt`
`java -cp bin mv2h.tools.Converter -x <gt_xml.txt >gt_converted.txt`
Input and output files can also be specified with -i FILE and -o FILE.

3. Score with alignment using the `-a` flag:
3. Evaluate with alignment using the `-a` flag:
`java -cp bin mv2h.Main -g gt_converted.txt -t trans_converted.txt -a`

Chord symbols will not be parsed, and all key signatures will be major.

See [Dataset](#dataset) for examples.

#### MIDI
Development in progress.
1. Convert a MIDI file into the MV2H format:
`java -cp bin mv2h.tools.Converter -m -i gt.mid >gt_converted.txt`
An output file can also be specified with -o FILE.

2. Evaluate with alignment using the `-a` flag:
`java -cp bin mv2h.Main -g gt_converted.txt -t trans_converted.txt -a`

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.

### Averaging Multiple Evaluations
To get the averages of many MV2H evaluations:
Expand Down
4 changes: 2 additions & 2 deletions src/mv2h/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public static void main(String[] args) throws IOException {
PRINT_ALIGNMENT = true;

case 'a':
DURATION_DELTA = 5;
DURATION_DELTA = 20;
ONSET_DELTA = 0;
GROUPING_EPSILON = 5;
GROUPING_EPSILON = 20;
PERFORM_ALIGNMENT = true;
break;

Expand Down
11 changes: 10 additions & 1 deletion src/mv2h/objects/meter/Meter.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,15 @@ public double getF1(Meter groundTruth) {

@Override
public String toString() {
return "Meters " + hierarchies + " Tatums " + tatums;
StringBuilder sb = new StringBuilder();

for (Hierarchy h : hierarchies) {
sb.append(h.toString()).append('\n');
}
for (Tatum t : tatums) {
sb.append(t.toString()).append('\n');
}

return sb.toString();
}
}

0 comments on commit 5f8d051

Please sign in to comment.