Runs the specified config file on a set of input data buffers and returns the specified set of output buffers.
(config_file: str, options: Dict[str, Any],
inputs: Dict[str, np.ndarray], outputs: List[str])
| 422 | |
| 423 | @staticmethod |
| 424 | def process(config_file: str, options: Dict[str, Any], |
| 425 | inputs: Dict[str, np.ndarray], outputs: List[str]) -> Dict[str, np.ndarray]: |
| 426 | """ |
| 427 | Runs the specified config file on a set of input data buffers and returns the |
| 428 | specified set of output buffers. |
| 429 | """ |
| 430 | opensmile = OpenSMILE() |
| 431 | opensmile.initialize(config_file, options) |
| 432 | |
| 433 | for (input, data) in inputs.items(): |
| 434 | if not opensmile.external_source_write_data(input, data): |
| 435 | raise Exception("Could not write input data to component '{}'".format(input)) |
| 436 | opensmile.external_source_set_eoi(input) |
| 437 | |
| 438 | output_data = {} |
| 439 | |
| 440 | for output in outputs: |
| 441 | def callback(data: np.ndarray): |
| 442 | if output not in output_data: |
| 443 | output_data[output] = np.copy(data) |
| 444 | else: |
| 445 | output_data[output] = np.vstack((output_data[output], data)) |
| 446 | opensmile.external_sink_set_callback(output, callback) |
| 447 | |
| 448 | opensmile.run() |
| 449 | opensmile.free() |
| 450 | return output_data |
nothing calls this directly
no test coverage detected