comparison vamp/collect.py @ 96:f0e005248b9a

More collect tweaks -- currently failing tests
author Chris Cannam
date Mon, 02 Feb 2015 17:31:30 +0000
parents 3e5791890b65
children 06c4afba4fc5
comparison
equal deleted inserted replaced
95:3e5791890b65 96:f0e005248b9a
67 shape = deduce_shape(output_desc) 67 shape = deduce_shape(output_desc)
68 out_step = get_feature_step_time(sample_rate, step_size, output_desc) 68 out_step = get_feature_step_time(sample_rate, step_size, output_desc)
69 69
70 if shape == "vector": 70 if shape == "vector":
71 rv = ( out_step, 71 rv = ( out_step,
72 np.array([r[output]["values"][0] for r in results]) ) 72 np.array([r[output]["values"][0] for r in results], np.float32) )
73 elif shape == "matrix": 73 elif shape == "matrix":
74 rv = ( out_step, 74 rv = ( out_step,
75 np.array( 75 np.array(
76 [[r[output]["values"][i] for r in results] 76 [[r[output]["values"][i] for r in results]
77 for i in range(0, output_desc["bin_count"])]) ) 77 for i in range(0, output_desc["bin_count"])], np.float32) )
78 else: 78 else:
79 rv = list(fill_timestamps(results, sample_rate, step_size, output_desc)) 79 rv = list(fill_timestamps(results, sample_rate, step_size, output_desc))
80 80
81 return rv 81 return rv
82 82
83 83
84 def collect(data, sample_rate, key, output, parameters = {}): 84 def collect(data, sample_rate, key, output = "", parameters = {}):
85 85
86 plugin, step_size, block_size = load.load_and_configure(data, sample_rate, key, parameters) 86 plugin, step_size, block_size = load.load_and_configure(data, sample_rate, key, parameters)
87 87
88 if output == "": 88 if output == "":
89 output_desc = plugin.get_output(0) 89 output_desc = plugin.get_output(0)
99 99
100 plugin.unload() 100 plugin.unload()
101 return rv 101 return rv
102 102
103 103
104 def collect_frames(ff, channels, sample_rate, step_size, key, output, parameters = {}): 104 def collect_frames(ff, channels, sample_rate, step_size, key, output = "", parameters = {}):
105 105
106 plug = vampyhost.load_plugin(key, sample_rate, 106 plug = vampyhost.load_plugin(key, sample_rate,
107 vampyhost.ADAPT_INPUT_DOMAIN + 107 vampyhost.ADAPT_INPUT_DOMAIN +
108 vampyhost.ADAPT_BUFFER_SIZE + 108 vampyhost.ADAPT_BUFFER_SIZE +
109 vampyhost.ADAPT_CHANNEL_COUNT) 109 vampyhost.ADAPT_CHANNEL_COUNT)