# HG changeset patch # User Chris Cannam # Date 1399550545 -3600 # Node ID 78e0f163e035d6474fc5c356b8808c52cc6c7ce1 # Parent e3373d367bda210901c8a2e07fc11a1195a17119 Forgot to add conversion script diff -r e3373d367bda -r 78e0f163e035 testdata/TRIOS-groundtruth/convert.yeti --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/testdata/TRIOS-groundtruth/convert.yeti Thu May 08 13:02:25 2014 +0100 @@ -0,0 +1,34 @@ + +// Convert CSV file exported by Sonic Visualiser: +// +// onset,midinote,duration,level,label +// +// into lab file like those output from the test scripts: +// +// onset offset frequency + +program convert; + +usage () = + eprintln "\nUsage: convert file.csv\n"; + +toFrequency m = + 440 * Math#pow(2.0, (m - 69) / 12.0); + +convert f = + (str = openInFile f "UTF-8"; + for (str.lines ()) do line: + case list (strSplit "," line) of + onset::midinote::duration::_: + println "\(onset)\t\((number onset) + (number duration))\t\(toFrequency (number midinote))"; + _: + failWith "badly formed line: \(line)"; + esac; + done; + str.close ()); + +case (list _argv) of +file::[]: convert file; +_: usage (); +esac; +