blob: da6d0c2e700deb3426320ce5de0dba16d2013818 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/python
# -*- coding: utf-8 -*-
# MusE external midi processing script
# By: Mathias Gyllengahm 2009
# DoubleSpeed
import sys,time
testFile = file(sys.argv[1],"r")
inputEvents = testFile.readlines()
testFile.close()
outputEvents=[]
#loop through events
for line in inputEvents:
if line.startswith('NOTE'):
tag,tick,pitch,length,velocity = line.split(' ')
newline = tag + " " + str(int(tick)/2) + " " + pitch + " " + length + " " + velocity
outputEvents.append(newline)
testFile = file(sys.argv[1],"w")
testFile.writelines(outputEvents)
testFile.close()
|