def getComponentParameters(name): ptr = yaafecore.getComponentParameters(to_char(name)) res = [(to_str(p.contents.identifier), to_str(p.contents.defaultValue), to_str(p.contents.description)) for p in iterPtrList(ptr)] yaafecore.freeComponentParameters(ptr) return res
def getOutputs(self): """ Get output metadata. For each output feature, you get the following metadata: :sampleRate: audio analysis samplerate :sampleStep: Number of audio samples between consecutive feature values :frameLength: Analysis frame size in number of audio samples :size: size the feature (or number of coefficients) :parameters: attached parameters. """ res = {} oList = yc.engine_getOutputList(self.ptr) for outputname in iterPtrList(oList): ptr = yc.engine_getOutputInfos(self.ptr, to_char(outputname)) infos = {} if ptr: infos['sampleRate'] = ptr.contents.sampleRate infos['sampleStep'] = ptr.contents.sampleStep infos['frameLength'] = ptr.contents.frameLength infos['size'] = ptr.contents.size infos['parameters'] = dict( (to_str(k), to_str(v)) for k, v in iterPtrDict(ptr.contents.parameters)) yc.engine_freeIOInfos(ptr) res[to_str(outputname)] = infos yc.engine_freeIOList(oList) return res
def getInputs(self): """ Get input metadata. Result format is the same as for :py:meth:`getOutputs` method, but the general case is that there is only one input named 'audio' and the sole relevant metadata are: :sampleRate: expected audio sampleRate :parameters: attached parameters Others fields should be set to 1. """ res = {} iList = yc.engine_getInputList(self.ptr) for inputname in iterPtrList(iList): ptr = yc.engine_getInputInfos(self.ptr, to_char(inputname)) infos = {} if ptr: infos['sampleRate'] = ptr.contents.sampleRate infos['sampleStep'] = ptr.contents.sampleStep infos['frameLength'] = ptr.contents.frameLength infos['size'] = ptr.contents.size infos['parameters'] = dict( (to_str(k), to_str(v)) for k, v in iterPtrDict(ptr.contents.parameters)) yc.engine_freeIOInfos(ptr) res[to_str(inputname)] = infos yc.engine_freeIOList(iList) return res
def __str__(self): """ Return the Dataflow in string, which can be reload via :ref:`DataFlow.loads <Dataflow.loads>` :return: Dataflow in string """ ptr = yc.dataflow_stringify(self.ptr) buf = cast(ptr, c_char_p).value yc.free_dataflow_stringify(ptr) return to_str(buf)
def readAllOutputs(self): """ Read all outputs. :return: dictionary with output name as key and numpy.array as value. """ res = {} oList = yc.engine_getOutputList(self.ptr) for o in iterPtrList(oList): res[to_str(o)] = self.readOutput(o) return res