comparison multiple_f0_estimation/silvet/frames.py @ 62:2b1e48b14423

Add framewise scripts
author Chris Cannam
date Wed, 12 Aug 2015 17:36:31 +0100
parents
children 029159daf3f1
comparison
equal deleted inserted replaced
61:3f0dbafd8bb4 62:2b1e48b14423
1 #!/usr/bin/env python
2
3 import sys
4
5 if __name__ == '__main__':
6
7 nargs = len(sys.argv)
8 if nargs != 2:
9 print("\nUsage: " + sys.argv[0] + " file.txt")
10 exit(1)
11
12 fname = sys.argv[1]
13
14 f = open(fname, 'r')
15
16 data = [ line.split(' ') for line in f ];
17 ms = 0
18 extant = {}
19 ix = 0
20
21 while ix < len(data):
22
23 sec = ms / 1000.0
24
25 while ix < len(data) and sec >= float(data[ix][0]):
26 time, freq, vely = data[ix][:3]
27 if vely == "0":
28 del extant[freq]
29 else:
30 extant[freq] = vely
31 ix = ix + 1
32
33 print("\t".join([str(sec)] + list(extant.keys())))
34
35 ms = ms + 10
36
37