comparison pyspark/ilm/transform.py @ 0:e34cf1b6fe09 tip

commit
author Daniel Wolff
date Sat, 20 Feb 2016 18:14:24 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:e34cf1b6fe09
1 # Part of DML (Digital Music Laboratory)
2 #
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
17 #!/usr/bin/python
18 # -*- coding: utf-8 -*-
19 __author__="hargreavess"
20 __date__ ="$29-Sep-2014 15:31:01$"
21
22 import subprocess
23 import time
24 import random
25 from os import walk
26
27 def transform(audio_file, vamp_transform_list, output_dir):
28 print "transforming " + audio_file
29
30 command = ['sonic-annotator']
31 command.extend(['-T', vamp_transform_list,
32 audio_file, '-w', 'rdf', '--rdf-force', '--rdf-basedir', output_dir, '--rdf-many-files',
33 '-w', 'csv', '--csv-force', '--csv-basedir', output_dir])
34
35 print "calling subprocess.subprocess.Popen..."
36 start = time.time()
37 p = subprocess.Popen(
38 command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
39 p.wait()
40
41 end = time.time()
42 print "finished in " + (str)(end-start)
43
44 return True
45