Mercurial > hg > silvet
view testdata/scripts/convert_svout.yeti @ 336:d25e4aee73d7 livemode
Add onset+offset output; look up shift counts rather than passing them around
author | Chris Cannam |
---|---|
date | Fri, 26 Jun 2015 10:23:54 +0100 |
parents | 51c18a17404a |
children |
line wrap: on
line source
// 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_svout; usage () = eprintln "\nUsage: convert_svout 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;