comparison vamp/collect.py @ 112:9343eee50605

Update to Python 3. Currently crashes during tests (and also, two tests are now failing, even with Py2).
author Chris Cannam
date Wed, 17 Jun 2015 12:35:41 +0100
parents 4f590fc46ace
children 2370b942cd32
comparison
equal deleted inserted replaced
111:4f590fc46ace 112:9343eee50605
1 '''A high-level interface to the vampyhost extension module, for quickly and easily running Vamp audio analysis plugins on audio files and buffers.''' 1 '''A high-level interface to the vampyhost extension module, for quickly and easily running Vamp audio analysis plugins on audio files and buffers.'''
2 2
3 import vampyhost 3 import vampyhost
4 import load 4 import vamp.load
5 import process 5 import vamp.process
6 import frames 6 import vamp.frames
7 7
8 import numpy as np 8 import numpy as np
9 9
10 def get_feature_step_time(sample_rate, step_size, output_desc): 10 def get_feature_step_time(sample_rate, step_size, output_desc):
11 if output_desc["sampleType"] == vampyhost.ONE_SAMPLE_PER_STEP: 11 if output_desc["sampleType"] == vampyhost.ONE_SAMPLE_PER_STEP:
122 (where the plugin supports this) and with the format in which the 122 (where the plugin supports this) and with the format in which the
123 plugin returns them, via an asynchronous generator function, use 123 plugin returns them, via an asynchronous generator function, use
124 vamp.process() instead. 124 vamp.process() instead.
125 """ 125 """
126 126
127 plugin, step_size, block_size = load.load_and_configure(data, sample_rate, key, parameters) 127 plugin, step_size, block_size = vamp.load.load_and_configure(data, sample_rate, key, parameters)
128 128
129 if output == "": 129 if output == "":
130 output_desc = plugin.get_output(0) 130 output_desc = plugin.get_output(0)
131 output = output_desc["identifier"] 131 output = output_desc["identifier"]
132 else: 132 else:
133 output_desc = plugin.get_output(output) 133 output_desc = plugin.get_output(output)
134 134
135 ff = frames.frames_from_array(data, step_size, block_size) 135 ff = vamp.frames.frames_from_array(data, step_size, block_size)
136 136
137 results = process.process_with_initialised_plugin(ff, sample_rate, step_size, plugin, [output]) 137 results = vamp.process.process_with_initialised_plugin(ff, sample_rate, step_size, plugin, [output])
138 138
139 rv = reshape(results, sample_rate, step_size, output_desc) 139 rv = reshape(results, sample_rate, step_size, output_desc)
140 140
141 plugin.unload() 141 plugin.unload()
142 return rv 142 return rv