utils/pianoroll-format.py
author ymh <ymh.work@gmail.com>
Mon, 13 Oct 2014 12:43:47 +0200
changeset 13 435d5c15275a
parent 0 e1d4d7a8255a
permissions -rw-r--r--
clean client npm and gulp config, change flask root url, reference static url in template, change config management to follow flask convention


import sys
import csv
import datetime
import time
import ntplib
from txosc import osc

if __name__ == '__main__':
    t0 = time.time()
    with open(sys.argv[1], 'rU') as datafile:
        reader = csv.reader(datafile, delimiter=' ')
        for row in reader:
            t1 = t0 + float(row[1])/10**3
            timetag = ntplib.system_to_ntp_time(t1)
            print " ".join([str(s) for s in [timetag, int(row[1]), 0] + [int(s) for s in row[2:4]]])