Mercurial > hg > vampy-host
diff vamp/__init__.py @ 61:f7ee26ca5304
Start on the main process stuff
author | Chris Cannam |
---|---|
date | Wed, 14 Jan 2015 10:36:55 +0000 |
parents | c444be7637c0 |
children | ee7542afa98e |
line wrap: on
line diff
--- a/vamp/__init__.py Wed Jan 14 10:36:22 2015 +0000 +++ b/vamp/__init__.py Wed Jan 14 10:36:55 2015 +0000 @@ -24,11 +24,27 @@ yield frame i = i + stepSize +def selectOutputs(result, outputs): + return result ##!!! for now + def process(data, samplerate, key, parameters, outputs): plug = vampyhost.loadPlugin(key, samplerate, vampyhost.AdaptInputDomain + vampyhost.AdaptChannelCount) stepSize = plug.getPreferredStepSize() blockSize = plug.getPreferredBlockSize() + if blockSize == 0: + blockSize = 1024 + if stepSize == 0: + stepSize = blockSize ##!!! or blockSize/2, but check this with input domain adapter + channels = 1 + if data.ndim > 1: + channels = data.shape[0] + plug.initialise(channels, stepSize, blockSize) ff = framesFromArray(data, stepSize, blockSize) - return True + fi = 0 + for f in ff: + result = plug.processBlock(f, vampyhost.frame2RealTime(fi, samplerate)) + yield selectOutputs(result, outputs) + fi = fi + stepSize +