Update SC classes
parent
0931042aff
commit
d0cbf95550
@ -1,36 +1,43 @@
|
||||
FluidBufAmpGate : UGen {
|
||||
FluidBufAmpGate : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking|
|
||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufAmpGateTrigger,-1, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq,maxSize, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, trig, blocking);
|
||||
}
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, action |
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq
|
||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||
|
||||
source = source ? -1;
|
||||
indices = indices ? -1;
|
||||
|
||||
^this.new(
|
||||
server, nil, [indices]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 0],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, action|
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||
|
||||
|
||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||
|
||||
source = source ? -1;
|
||||
indices = indices ? -1;
|
||||
|
||||
^this.new(
|
||||
server, nil, [indices]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 1],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices], blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,35 +1,39 @@
|
||||
FluidBufAmpSlice : UGen {
|
||||
FluidBufAmpSlice : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufAmpSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking);
|
||||
}
|
||||
*process { |server,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, freeWhenDone = true, action |
|
||||
|
||||
*process { |server,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, action |
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
|
||||
^this.new(server, nil, [indices]).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,0],freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, action|
|
||||
*processBlocking { |server,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, freeWhenDone = true, action |
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices], blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq
|
||||
^this.new(server, nil, [indices]).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,1],freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,33 +1,38 @@
|
||||
FluidBufCompose : UGen {
|
||||
FluidBufCompose : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, trig = 1, blocking|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, trig = 1, blocking = 1|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1, source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, trig = 1, blocking = 1|
|
||||
^this.new1('control', source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [destination], blocking:1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain
|
||||
);
|
||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||
|
||||
^this.new( server, nil, [destination]).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);//NB always blocking
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, action|
|
||||
^process(
|
||||
source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain
|
||||
);
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, freeWhenDone, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination]
|
||||
).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +1,46 @@
|
||||
FluidBufFlatten : UGen {
|
||||
FluidBufFlatten : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, destination, axis = 1, trig = 1, blocking|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
*kr { |source, destination, axis = 1, trig = 1, blocking = 1|
|
||||
|
||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||
^super.new1(rate, source, destination, axis, trig, blocking);
|
||||
}
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
*kr { |source, destination, axis = 1, trig = 1, blocking = 1|
|
||||
^this.new1('control', source, destination, axis, trig, blocking);
|
||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||
|
||||
^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, destination, axis, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, destination, axis = 1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [destination], blocking:1
|
||||
).process(
|
||||
source, destination, axis
|
||||
*process { |server, source, destination, axis = 1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination],
|
||||
).processList(
|
||||
[source, destination, axis,0],freeWhenDone,action
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, destination, axis = 1, action|
|
||||
^process(
|
||||
source, destination, axis
|
||||
);
|
||||
}
|
||||
*processBlocking { |server, source, destination, axis = 1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination],
|
||||
).processList(
|
||||
[source, destination, axis,1],freeWhenDone,action
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,45 +1,51 @@
|
||||
FluidBufHPSS : UGen {
|
||||
FluidBufHPSS : FluidBufProcessor {
|
||||
|
||||
*new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
harmonic = harmonic.asUGenInput;
|
||||
percussive = percussive.asUGenInput;
|
||||
residual = residual.asUGenInput;
|
||||
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||
harmonic = harmonic ? -1;
|
||||
percussive = percussive ? -1;
|
||||
residual = residual ? -1;
|
||||
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufHPSSTrigger, -1, source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize, trig, blocking
|
||||
);
|
||||
}
|
||||
|
||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
*process {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone=true, action|
|
||||
|
||||
^this.multiNew(
|
||||
'control', source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, trig, blocking
|
||||
);
|
||||
}
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
*process {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
harmonic = harmonic ? -1;
|
||||
percussive = percussive ? -1;
|
||||
residual = residual ? -1;
|
||||
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [harmonic, percussive, residual].select{|x| x!= -1}
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize
|
||||
|
||||
^this.new(
|
||||
server, nil, [harmonic, percussive, residual].select{|x| x!= -1}
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize,0], freeWhenDone,action
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
*processBlocking {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
*processBlocking {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone=true, action|
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [harmonic, percussive, residual].select{|x| x!= -1}, blocking:1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize
|
||||
);
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
}
|
||||
harmonic = harmonic ? -1;
|
||||
percussive = percussive ? -1;
|
||||
residual = residual ? -1;
|
||||
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
|
||||
|
||||
|
||||
^this.new(
|
||||
server, nil, [harmonic, percussive, residual].select{|x| x!= -1}
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize,harmFilterSize, percFilterSize,1], freeWhenDone,action
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,38 +1,50 @@
|
||||
FluidBufMelBands : UGen {
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
FluidBufMelBands : FluidBufProcessor {
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||
// same for maxNumBands which is passed numBands
|
||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufMelBandsTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [features]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, normalize, windowSize, hopSize, fftSize
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [features]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [features], blocking:1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, normalize, windowSize, hopSize, fftSize
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [features]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize,1],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,47 +1,36 @@
|
||||
FluidBufNMF : UGen {
|
||||
|
||||
*new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
resynth = resynth.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
FluidBufNMF : FluidBufProcessor //: UGen {
|
||||
{
|
||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
||||
|
||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||
|
||||
resynth = resynth ? -1;
|
||||
bases = bases ? -1;
|
||||
activations = activations ? -1;
|
||||
|
||||
^super.new1(rate,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
|
||||
}
|
||||
|
||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0|
|
||||
^this.new1(\control,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
|
||||
^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,freeWhenDone = true, action|
|
||||
|
||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||
resynth = resynth ? -1;
|
||||
bases = bases ? -1;
|
||||
activations = activations ? -1;
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [resynth, bases, activations].select{|x| x!= -1}
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
|
||||
);
|
||||
^this.new(
|
||||
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||
).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize,0],freeWhenDone,action);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,freeWhenDone = true, action|
|
||||
|
||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||
resynth = resynth ? -1;
|
||||
bases = bases ? -1;
|
||||
activations = activations ? -1;
|
||||
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [resynth, bases, activations].select{|x| x!= -1},blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
|
||||
);
|
||||
^this.new(
|
||||
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||
).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, 1],freeWhenDone,action);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,34 +1,48 @@
|
||||
FluidBufNMFCross : UGen{
|
||||
FluidBufNMFCross : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
*kr { |source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
target = target.asUGenInput;
|
||||
output = output.asUGenInput;
|
||||
source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw};
|
||||
target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw};
|
||||
target = target.asUGenInput;
|
||||
output = output.asUGenInput;
|
||||
source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw};
|
||||
target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw};
|
||||
output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw};
|
||||
|
||||
^super.new1(rate, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufNMFCrossTrigger, -1, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
*process { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
target = target.asUGenInput;
|
||||
output = output.asUGenInput;
|
||||
source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw};
|
||||
target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw};
|
||||
output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw};
|
||||
|
||||
*process { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [output].select{|x| x!= -1}
|
||||
).process(
|
||||
source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize
|
||||
|
||||
^this.new(
|
||||
server, nil, [output]
|
||||
).processList(
|
||||
[source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize,0],freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [output].select{|x| x!= -1}, blocking: 1
|
||||
).process(
|
||||
source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize
|
||||
*processBlocking { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
target = target.asUGenInput;
|
||||
output = output.asUGenInput;
|
||||
source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw};
|
||||
target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw};
|
||||
output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw};
|
||||
|
||||
|
||||
^this.new(
|
||||
server, nil, [output]
|
||||
).processList(
|
||||
[source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize,1],freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,35 +1,47 @@
|
||||
FluidBufNNDSVD : UGen{
|
||||
*new1 { |rate, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking=0|
|
||||
FluidBufNNDSVD : FluidBufProcessor{
|
||||
|
||||
source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
|
||||
bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
*kr { |source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
^super.new1(rate, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking)
|
||||
source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
|
||||
bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
|
||||
^FluidProxyUgen.kr1(\FluidBufNNDSVDTrigger, -1, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
^this.new1(\control, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
*process { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [bases]
|
||||
).process(
|
||||
source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize
|
||||
source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
|
||||
bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
|
||||
^this.new(
|
||||
server, nil, [bases]
|
||||
).processList(
|
||||
[source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize,0],freeWhenDone, action
|
||||
)
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [bases],blocking:1
|
||||
).process(
|
||||
source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize
|
||||
*processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
|
||||
bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
|
||||
^this.new(
|
||||
server, nil, [bases]
|
||||
).processList(
|
||||
[source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize,1],freeWhenDone, action
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,37 +1,48 @@
|
||||
FluidBufOnsetSlice : UGen {
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
FluidBufOnsetSlice : FluidBufProcessor {
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufOnsetSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, trig, blocking);
|
||||
}
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize
|
||||
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [indices]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [indices], blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [indices]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize,maxFFTSize,1],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,39 +1,50 @@
|
||||
FluidBufPitch : UGen{
|
||||
FluidBufPitch : FluidBufProcessor{
|
||||
|
||||
*new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||
|
||||
//NB For wrapped versions of NRT classes, we set the params for maxima to
|
||||
//whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value)
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufPitchTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||
|
||||
}
|
||||
|
||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, trig, blocking);
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
}
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [features]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize
|
||||
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [features]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, 0], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [features], blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
features = features.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
|
||||
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [features]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, 1], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +1,43 @@
|
||||
FluidBufScale : UGen {
|
||||
FluidBufScale : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
||||
}
|
||||
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1|
|
||||
^this.new1('control', source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufScaleTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [destination], blocking:1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh
|
||||
);
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 0], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action|
|
||||
^process(
|
||||
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh
|
||||
);
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 1], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,36 +1,51 @@
|
||||
FluidBufStats : UGen{
|
||||
FluidBufStats : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0|
|
||||
|
||||
source = source.asUGenInput;
|
||||
stats = stats.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
stats = stats.asUGenInput;
|
||||
weights = weights.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufStats: Invalid source buffer".throw};
|
||||
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
|
||||
weights = weights ? -1;
|
||||
source.isNil.if {"FluidBufStats: Invalid source buffer".throw};
|
||||
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
|
||||
weights = weights ? -1;
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufStatsTrigger, -1, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking);
|
||||
}
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking);
|
||||
}
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
stats = stats.asUGenInput;
|
||||
weights = weights.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufStats: Invalid source buffer".throw};
|
||||
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
|
||||
weights = weights ? -1;
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [stats]
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights
|
||||
^this.new(
|
||||
server, nil, [stats]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights, 0], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [stats], blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
stats = stats.asUGenInput;
|
||||
weights = weights.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufStats: Invalid source buffer".throw};
|
||||
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
|
||||
weights = weights ? -1;
|
||||
|
||||
^this.new(
|
||||
server, nil, [stats]
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights, 1], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,29 +1,33 @@
|
||||
FluidBufThreadDemo : UGen{
|
||||
FluidBufThreadDemo : FluidBufProcessor{
|
||||
|
||||
*new1 {|rate, result, time, trig = 1, blocking = 0 |
|
||||
result = result.asUGenInput;
|
||||
result.isNil.if {this.class.name+": Invalid output buffer".throw};
|
||||
^super.new1(rate, result, time, trig, blocking);
|
||||
}
|
||||
*kr {|result, time, trig = 1, blocking = 0|
|
||||
|
||||
result = result.asUGenInput;
|
||||
result.isNil.if {this.class.name+": Invalid output buffer".throw};
|
||||
|
||||
*kr {|result, time, trig = 1, blocking = 0|
|
||||
^this.new1(\control, result, time, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufThreadDemoTrigger, -1, result, time, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, result, time = 1000, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [result]
|
||||
).process(
|
||||
result, time
|
||||
*process { |server, result, time = 1000, freeWhenDone = true, action|
|
||||
|
||||
|
||||
result ?? {this.class.name+": Invalid output buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [result]
|
||||
).processList(
|
||||
[result.asUGenInput, time, 0], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, result, time = 1000, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [result], blocking: 1
|
||||
).process(
|
||||
result, time
|
||||
*processBlocking { |server, result, time = 1000, freeWhenDone = true, action|
|
||||
|
||||
result ?? {this.class.name+": Invalid output buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [result]
|
||||
).processList(
|
||||
[result.asUGenInput, time, 1], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +1,45 @@
|
||||
FluidBufThresh : UGen {
|
||||
FluidBufThresh : FluidBufProcessor {
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking|
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
||||
}
|
||||
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1|
|
||||
^this.new1('control', source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufThreshTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action, [destination], blocking:1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, destination, threshold
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination],
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, destination, threshold, 0], freeWhenDone, action
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action|
|
||||
^process(
|
||||
source, startFrame, numFrames, startChan, numChans, destination, threshold
|
||||
);
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil, [destination],
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, destination, threshold, 1], freeWhenDone, action
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,30 +1,43 @@
|
||||
FluidBufTransientSlice : UGen{
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0|
|
||||
FluidBufTransientSlice : FluidBufProcessor {
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
*objectClassName{^\FluidBufTrSlice}
|
||||
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0|
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking);
|
||||
}
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking);
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
|
||||
^FluidProxyUgen.kr(\FluidBufTransientSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action,[indices]
|
||||
).process(source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil,[indices]
|
||||
).processList([source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength,0], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action,[indices], blocking: 1
|
||||
).process(source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil,[indices]
|
||||
).processList([source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength,1], freeWhenDone, action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,36 +1,43 @@
|
||||
FluidBufTransients : UGen {
|
||||
FluidBufTransients : FluidBufProcessor {
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0|
|
||||
|
||||
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0 |
|
||||
|
||||
source = source.asUGenInput;
|
||||
transients = transients.asUGenInput;
|
||||
residual = residual.asUGenInput;
|
||||
source = source.asUGenInput;
|
||||
transients = transients ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||
|
||||
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
||||
^FluidProxyUgen.kr(\FluidBufTransientsTrigger, -1, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
||||
}
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action|
|
||||
|
||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0|
|
||||
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking);
|
||||
source = source.asUGenInput;
|
||||
transients = transients ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
}
|
||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||
|
||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action,[transients, residual].select{|x| x!= -1}
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength
|
||||
^this.new(
|
||||
server, nil,[transients, residual].select{|x| x!= -1}
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,0],freeWhenDone,action
|
||||
);
|
||||
}
|
||||
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action|
|
||||
^FluidNRTProcess.new(
|
||||
server, this, action,[transients, residual].select{|x| x!= -1}, blocking: 1
|
||||
).process(
|
||||
source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength
|
||||
);
|
||||
}
|
||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action|
|
||||
|
||||
source = source.asUGenInput;
|
||||
transients = transients ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||
|
||||
^this.new(
|
||||
server, nil,[transients, residual].select{|x| x!= -1}
|
||||
).processList(
|
||||
[source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,1],freeWhenDone = true,action
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,91 +1,64 @@
|
||||
|
||||
FluidDataSetExistsError : Exception{
|
||||
}
|
||||
|
||||
FluidDataSet : FluidManipulationClient {
|
||||
FluidDataSet : FluidDataObject
|
||||
{
|
||||
|
||||
var <id;
|
||||
classvar serverCaches;
|
||||
addPointMsg{|label,buffer|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
^this.prMakeMsg(\addPoint,id,label.asSymbol,buffer);
|
||||
}
|
||||
|
||||
*initClass {
|
||||
serverCaches = FluidServerCache.new;
|
||||
addPoint{|label, buffer, action|
|
||||
actions[\addPoint] = [nil,action];
|
||||
this.prSendMsg(this.addPointMsg(label,buffer));
|
||||
}
|
||||
|
||||
*at{ |server, name|
|
||||
^serverCaches.tryPerform(\at, server, name)
|
||||
}
|
||||
getPointMsg{|label,buffer|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
^this.prMakeMsg(\getPoint,id,label.asSymbol,buffer);
|
||||
}
|
||||
|
||||
*new { |server, name|
|
||||
if(this.at(server,name).notNil){
|
||||
FluidDataSetExistsError("A FluidDataset called % already exists.".format(name)).throw;
|
||||
^nil
|
||||
}
|
||||
^super.new(server,FluidManipulationClient.prServerString(name))!?{|inst|inst.init(name);inst}
|
||||
}
|
||||
getPoint{|label, buffer, action|
|
||||
actions[\getPoint] = [nil,action];
|
||||
this.prSendMsg(this.getPointMsg(label,buffer));
|
||||
}
|
||||
|
||||
init {|name|
|
||||
this.baseinit(FluidManipulationClient.prServerString(name));
|
||||
id = name;
|
||||
this.cache;
|
||||
}
|
||||
updatePointMsg{|label,buffer|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
^this.prMakeMsg(\updatePoint,id,label.asSymbol,buffer);
|
||||
}
|
||||
|
||||
cache {
|
||||
serverCaches.initCache(server);
|
||||
serverCaches.put(server,id,this);
|
||||
}
|
||||
updatePoint{|label, buffer, action|
|
||||
actions[\updatePoint] = [nil,action];
|
||||
this.prSendMsg(this.updatePointMsg(label,buffer));
|
||||
}
|
||||
|
||||
*asUGenInput { |input|
|
||||
var ascii = input.asString.ascii;
|
||||
^[ascii.size].addAll(ascii)
|
||||
}
|
||||
deletePointMsg{|label| ^this.prMakeMsg(\deletePoint,id);}
|
||||
|
||||
asString {
|
||||
^"FluidDataSet(%)".format(id).asString;
|
||||
}
|
||||
deletePoint{|label, buffer, action|
|
||||
actions[\deletePoint] = [nil,action];
|
||||
this.prSendMsg(this.deletePointMsg(label));
|
||||
}
|
||||
|
||||
asSymbol {
|
||||
^id.asSymbol
|
||||
}
|
||||
clearMsg { ^this.prMakeMsg(\clear,id); }
|
||||
|
||||
addPoint{|label, buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\addPoint,[label.asSymbol,buffer],action);
|
||||
clear { |action|
|
||||
actions[\clear] = [nil,action];
|
||||
this.prSendMsg(this.clearMsg);
|
||||
}
|
||||
|
||||
getPoint{|label, buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\getPoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
|
||||
}
|
||||
|
||||
updatePoint{|label, buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\updatePoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]);
|
||||
}
|
||||
|
||||
deletePoint{|label, action|
|
||||
this.prSendMsg(\deletePoint,[label.asSymbol],action);
|
||||
}
|
||||
|
||||
clear { |action|
|
||||
this.prSendMsg(\clear,[],action);
|
||||
}
|
||||
mergeMsg{|sourceDataSet, overwrite = 0|
|
||||
^this.prMakeMsg(\merge,id,sourceDataSet.asUGenInput,overwrite);
|
||||
}
|
||||
|
||||
merge{|sourceDataSet, overwrite = 0, action|
|
||||
this.prSendMsg(\merge,
|
||||
[sourceDataSet.asSymbol, overwrite], action);
|
||||
actions[\merge] = [nil,action];
|
||||
this.prSendMsg(this.mergeMsg(sourceDataSet,overwrite));
|
||||
}
|
||||
|
||||
print { |action|
|
||||
action ?? {action = postit};
|
||||
this.prSendMsg(\print,[],action,[string(FluidMessageResponse,_,_)]);
|
||||
}
|
||||
|
||||
free {
|
||||
serverCaches.remove(server,id);
|
||||
super.free;
|
||||
}
|
||||
printMsg { ^this.prMakeMsg(\print,id); }
|
||||
|
||||
*freeAll { |server|
|
||||
serverCaches.do(server,{|x|x.free;});
|
||||
print { |action=(postResponse)|
|
||||
actions[\print] = [string(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.printMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,52 +1,84 @@
|
||||
|
||||
FluidDataSetQuery : FluidManipulationClient {
|
||||
FluidDataSetQuery : FluidDataObject {
|
||||
|
||||
*new {|server|
|
||||
var uid = UniqueID.next;
|
||||
^super.new(server,uid)!?{|inst|inst.init(uid);inst}
|
||||
}
|
||||
|
||||
init {|uid|
|
||||
id = uid;
|
||||
this.baseinit(uid);
|
||||
}
|
||||
addColumnMsg { |column|
|
||||
^this.prMakeMsg(\addColumn,id,column);
|
||||
}
|
||||
|
||||
addColumn{|column, action|
|
||||
this.prSendMsg(\addColumn, [column], action);
|
||||
actions[\addColumn] = [nil,action];
|
||||
this.prSendMsg(this.addColumnMsg(column));
|
||||
}
|
||||
|
||||
addRangeMsg{|start,count|
|
||||
^this.prMakeMsg(\addRange,id,start,count);
|
||||
}
|
||||
|
||||
addRange{|start, count, action|
|
||||
this.prSendMsg(\addRange, [start, count], action);
|
||||
actions[\addRange] = [nil, action];
|
||||
this.prSendMsg(this.addRangeMsg(start, count));
|
||||
}
|
||||
|
||||
filterMsg{|column, condition, value, action|
|
||||
^this.prMakeMsg(\filter,id,column,condition.asSymbol,value);
|
||||
}
|
||||
|
||||
filter{|column, condition, value, action|
|
||||
this.prSendMsg(\filter, [column, condition.asSymbol, value], action);
|
||||
actions[\filter] = [nil, action];
|
||||
this.prSendMsg(this.filterMsg(column, condition, value));
|
||||
}
|
||||
|
||||
andMsg{ |column, condition, value|
|
||||
^this.prMakeMsg(\and,id,column, condition.asSymbol, value);
|
||||
}
|
||||
|
||||
and{|column, condition, value, action|
|
||||
this.prSendMsg(\and, [column, condition, value], action);
|
||||
actions[\and] = [nil, action];
|
||||
this.prSendMsg(this.andMsg(column,condition,value));
|
||||
}
|
||||
|
||||
orMsg{|column, condition, value|
|
||||
^this.prMakeMsg(\or,id,column, condition.asSymbol, value)
|
||||
}
|
||||
|
||||
or{|column, condition, value, action|
|
||||
this.prSendMsg(\or, [column, condition, value], action);
|
||||
actions[\or] = [nil,action];
|
||||
this.prSendMsg(this.orMsg(column, condition, value));
|
||||
}
|
||||
|
||||
clearMsg{
|
||||
^this.prMakeMsg(\clear,id);
|
||||
}
|
||||
|
||||
clear{|action|
|
||||
this.prSendMsg(\clear, [], action);
|
||||
actions[\clear] = [nil, action];
|
||||
this.prSendMsg(this.clearMsg);
|
||||
}
|
||||
|
||||
limitMsg{|rows|
|
||||
^this.prMakeMsg(\limit,id,rows);
|
||||
}
|
||||
|
||||
limit{|rows, action|
|
||||
this.prSendMsg(\limit, [rows], action);
|
||||
actions[\limit] = [nil,action];
|
||||
this.prSendMsg(this.limitMsg(rows));
|
||||
}
|
||||
|
||||
transformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||
}
|
||||
|
||||
transform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\transform,[sourceDataSet.asSymbol, destDataSet.asSymbol],action);
|
||||
actions[\transform] = [nil,action];
|
||||
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||
}
|
||||
|
||||
transformJoinMsg{|source1DataSet, source2DataSet, destDataSet|
|
||||
^this.prMakeMsg(\transformJoin,id,source1DataSet.id, source2DataSet.id, destDataSet.id);
|
||||
}
|
||||
|
||||
transformJoin{|source1DataSet, source2DataSet, destDataSet, action|
|
||||
this.prSendMsg(\transformJoin,[source1DataSet.asSymbol, source2DataSet.asSymbol, destDataSet.asSymbol],action);
|
||||
actions[\transformJoin] = [nil,action];
|
||||
this.prSendMsg(this.transformJoinMsg(source1DataSet, source2DataSet, destDataSet));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,11 @@
|
||||
FluidDataSetWr : UGen {
|
||||
FluidDataSetWr : FluidBufProcessor {
|
||||
*kr { |dataset,labelPrefix = "", labelOffset = 0,buf, trig=1, blocking = 1|
|
||||
var args;
|
||||
buf ?? {"No input buffer provided".error};
|
||||
labelPrefix = labelPrefix !? {[labelPrefix.asString.size] ++ labelPrefix.asString.ascii} ?? {0};
|
||||
|
||||
*new1 { |rate, dataset, labelPrefix = "", labelOffset = 0, buf, trig, blocking|
|
||||
buf ?? {"No input buffer provided".error};
|
||||
^super.new1(rate,*(FluidManipulationClient.prServerString(dataset.asSymbol)
|
||||
++ FluidDataSet.asUGenInput(labelPrefix.asSymbol) ++ labelOffset.asInteger.asUGenInput ++buf.asUGenInput ++ trig ++ blocking));
|
||||
}
|
||||
args = [-1] ++ dataset.asUGenInput ++labelPrefix ++ labelOffset.asInteger.asUGenInput ++buf.asUGenInput ++ trig ++ blocking;
|
||||
|
||||
*kr { |dataset,labelPrefix = "", labelOffset = 0,buf, trig=1, blocking = 0|
|
||||
^this.new1(\control,dataset,labelPrefix,labelOffset, buf, trig, blocking)
|
||||
^FluidProxyUgen.kr(\FluidDataSetWrTrigger,*args);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,41 +1,60 @@
|
||||
FluidKDTree : FluidRTDataClient {
|
||||
FluidKDTree : FluidRealTimeModel
|
||||
{
|
||||
|
||||
*new {|server,numNeighbours = 1, radius = 0, lookupDataSet = ""|
|
||||
var env;
|
||||
var names = [\numNeighbours, \radius]
|
||||
++ this.prServerString(lookupDataSet.asSymbol).collect{|x,i|
|
||||
("lookupDataSet"++i).asSymbol;
|
||||
};
|
||||
var neighbours,radius,lookup;
|
||||
|
||||
var values = [numNeighbours, radius] ++ this.prServerString(lookupDataSet.asSymbol);
|
||||
var params = [names,values].lace;
|
||||
*new{ |server, numNeighbours = 1, radius = 0, lookupDataSet|
|
||||
^super.new(server,[numNeighbours,radius,lookupDataSet ? -1])
|
||||
.numNeighbours_(numNeighbours)
|
||||
.radius_(radius)
|
||||
.lookupDataSet_(lookupDataSet);
|
||||
}
|
||||
|
||||
numNeighbours_{|k|neighbours = k.asInteger; }
|
||||
numNeighbours{ ^neighbours; }
|
||||
|
||||
/* env = Environment();
|
||||
synthControls[1..].do{|x|
|
||||
env.put(x,0);
|
||||
};
|
||||
env.put(\numNeighbours,1); */
|
||||
radius_{|r| radius = r.asUGenInput;}
|
||||
radius{ ^radius; }
|
||||
|
||||
^super.new1(server,params);
|
||||
/* env,
|
||||
[\numNeighbours]++lookupDataSet); */
|
||||
}
|
||||
lookupDataSet_{|ds| lookup = ds ? -1; }
|
||||
lookupDataSet{|ds| ^ (lookup ? -1) }
|
||||
|
||||
prGetParams{^[this.numNeighbours,this.radius,this.lookupDataSet,-1,-1];}
|
||||
|
||||
fitMsg{ |dataSet| ^this.prMakeMsg(\fit,this.id,dataSet.id);}
|
||||
|
||||
fit{|dataSet,action|
|
||||
this.prSendMsg(\fit, [dataSet.asSymbol], action);
|
||||
actions[\fit] = [nil,action];
|
||||
this.prSendMsg(this.fitMsg(dataSet));
|
||||
}
|
||||
|
||||
kNearestMsg{|buffer|
|
||||
^this.prMakeMsg(\kNearest,id,this.prEncodeBuffer(buffer));
|
||||
}
|
||||
|
||||
kNearest{ |buffer, action|
|
||||
this.prSendMsg(\kNearest,
|
||||
[buffer.asUGenInput], action,
|
||||
[strings(FluidMessageResponse,_,_)]
|
||||
);
|
||||
actions[\kNearest] = [strings(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.kNearestMsg(buffer));
|
||||
}
|
||||
|
||||
kNearestDistMsg {|buffer|
|
||||
^this.prMakeMsg(\kNearestDist,id,this.prEncodeBuffer(buffer));
|
||||
}
|
||||
|
||||
kNearestDist { |buffer, action|
|
||||
this.prSendMsg(\kNearestDist, [buffer.asUGenInput], action,
|
||||
[numbers(FluidMessageResponse,_,nil,_)]
|
||||
);
|
||||
actions[\kNearestDist] = [numbers(FluidMessageResponse,_,nil,_),action];
|
||||
this.prSendMsg(this.kNearestDistMsg(buffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer, numNeighbours = 1, lookupDataSet|
|
||||
this.numNeighbours_(numNeighbours);
|
||||
lookupDataSet = lookupDataSet ? -1;
|
||||
this.lookupDataSet_(lookupDataSet);
|
||||
this.lookupDataSet.asUGenInput.postln;
|
||||
^FluidProxyUgen.kr('FluidKDTree/query', K2A.ar(trig),
|
||||
id, this.numNeighbours, this.radius, this.lookupDataSet.asUGenInput,
|
||||
this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,35 +1,68 @@
|
||||
FluidKMeans : FluidRTDataClient {
|
||||
FluidKMeans : FluidRealTimeModel {
|
||||
|
||||
var clusters, maxiter;
|
||||
|
||||
*new {|server, numClusters = 4, maxIter = 100|
|
||||
^super.new1(server,[\numClusters,numClusters,\maxIter,maxIter]);
|
||||
^super.new(server,[numClusters,maxIter])
|
||||
.numClusters_(numClusters)
|
||||
.maxIter_(maxIter);
|
||||
}
|
||||
|
||||
fit{|dataSet,action|
|
||||
this.prSendMsg(\fit,
|
||||
[dataSet.asSymbol], action,
|
||||
[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
||||
);
|
||||
}
|
||||
numClusters_{|n| clusters = n.asInteger}
|
||||
numClusters{ ^clusters }
|
||||
|
||||
maxIter_{|i| maxiter = i.asInteger}
|
||||
maxIter{ ^maxiter }
|
||||
|
||||
prGetParams{^[this.numClusters,this.maxIter,-1,-1];}
|
||||
|
||||
fitMsg{ |dataSet| ^this.prMakeMsg(\fit,id,dataSet.id);}
|
||||
|
||||
fit{|dataSet, action|
|
||||
actions[\fit] = [
|
||||
numbers( FluidMessageResponse, _, this.numClusters ,_),
|
||||
action
|
||||
];
|
||||
this.prSendMsg(this.fitMsg(dataSet));
|
||||
}
|
||||
|
||||
fitPredictMsg{|dataSet, labelSet|
|
||||
^this.prMakeMsg(\fitPredict, id, dataSet.id, labelSet.id)
|
||||
}
|
||||
|
||||
fitPredict{|dataSet, labelSet,action|
|
||||
this.prSendMsg(\fitPredict,
|
||||
[dataSet.asSymbol,labelSet.asSymbol],
|
||||
action,[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
||||
);
|
||||
actions[\fitPredict] = [
|
||||
numbers(FluidMessageResponse, _, this.numClusters, _),
|
||||
action
|
||||
];
|
||||
this.prSendMsg(this.fitPredictMsg(dataSet,labelSet));
|
||||
}
|
||||
|
||||
predict{ |dataSet, labelSet,action|
|
||||
this.prSendMsg(\predict,
|
||||
[dataSet.asSymbol, labelSet.asSymbol], action,
|
||||
[numbers(FluidMessageResponse,_,this.numClusters,_)]
|
||||
);
|
||||
predictMsg{|dataSet, labelSet|
|
||||
^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
|
||||
}
|
||||
|
||||
predict{ |dataSet, labelSet, action|
|
||||
actions[\predict] = [
|
||||
numbers(FluidMessageResponse, _, this.numClusters, _),
|
||||
action
|
||||
];
|
||||
this.prSendMsg(this.predictMsg(dataSet,labelSet));
|
||||
}
|
||||
|
||||
predictPointMsg{|buffer|
|
||||
^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer))
|
||||
}
|
||||
|
||||
predictPoint { |buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\predictPoint,
|
||||
[buffer], action,
|
||||
[number(FluidMessageResponse,_,_)]
|
||||
);
|
||||
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.predictPointMsg(buffer))
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer|
|
||||
^FluidProxyUgen.kr('FluidKMeans/query', K2A.ar(trig),
|
||||
id, clusters, maxiter,
|
||||
this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,47 @@
|
||||
FluidKNNClassifier : FluidRTDataClient {
|
||||
FluidKNNClassifier : FluidRealTimeModel {
|
||||
|
||||
var <>numNeighbours, <>weight;
|
||||
|
||||
*new {|server, numNeighbours = 3, weight = 1|
|
||||
^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]);
|
||||
^super.new(server,[numNeighbours,weight])
|
||||
.numNeighbours_(numNeighbours)
|
||||
.weight_(weight);
|
||||
}
|
||||
|
||||
prGetParams{^[this.numNeighbours,this.weight,-1,-1];}
|
||||
|
||||
fitMsg{|dataSet, labelSet|
|
||||
^this.prMakeMsg(\fit, id, dataSet.id, labelSet.id)
|
||||
}
|
||||
|
||||
fit{|dataSet, labelSet, action|
|
||||
this.prSendMsg(\fit,[dataSet.asSymbol, labelSet.asSymbol], action);
|
||||
actions[\fit] = [nil,action];
|
||||
this.prSendMsg(this.fitMsg(dataSet, labelSet));
|
||||
}
|
||||
|
||||
predict{|dataSet, labelSet, action|
|
||||
this.prSendMsg(\predict,
|
||||
[dataSet.asSymbol, labelSet.asSymbol],
|
||||
action);
|
||||
predictMsg{|dataSet, labelSet|
|
||||
^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
|
||||
}
|
||||
|
||||
predict{|dataSet, labelSet, action|
|
||||
actions[\predict] = [nil, action];
|
||||
this.prSendMsg(this.predictMsg(dataSet, labelSet));
|
||||
}
|
||||
|
||||
predictPointMsg{|buffer|
|
||||
^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer))
|
||||
}
|
||||
|
||||
predictPoint {|buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\predictPoint,
|
||||
[buffer.asUGenInput], action,
|
||||
[string(FluidMessageResponse,_,_)]
|
||||
);
|
||||
actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.predictPointMsg(buffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer|
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, this.numNeighbours, this.weight,
|
||||
this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,25 +1,46 @@
|
||||
FluidKNNRegressor : FluidRTDataClient {
|
||||
FluidKNNRegressor : FluidRealTimeModel {
|
||||
|
||||
var <>numNeighbours, <>weight;
|
||||
|
||||
*new {|server, numNeighbours = 3, weight = 1|
|
||||
^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]);
|
||||
^super.new(server,[numNeighbours,weight])
|
||||
.numNeighbours_(numNeighbours)
|
||||
.weight_(weight);
|
||||
}
|
||||
|
||||
prGetParams{^[this.numNeighbours,this.weight,-1,-1];}
|
||||
|
||||
fitMsg{|sourceDataSet, targetDataSet|
|
||||
^this.prMakeMsg(\fit,this.id,sourceDataSet.id,targetDataSet.id)
|
||||
}
|
||||
|
||||
fit{|sourceDataSet, targetDataSet, action|
|
||||
this.prSendMsg(\fit,
|
||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
||||
action
|
||||
);
|
||||
actions[\fit] = [nil,action];
|
||||
this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet));
|
||||
}
|
||||
|
||||
predictMsg{ |sourceDataSet, targetDataSet|
|
||||
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
|
||||
}
|
||||
|
||||
predict{ |sourceDataSet, targetDataSet,action|
|
||||
this.prSendMsg(\predict,
|
||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
||||
action);
|
||||
actions[\predict] = [nil, action];
|
||||
this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
|
||||
}
|
||||
|
||||
predictPointMsg { |buffer|
|
||||
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer));
|
||||
}
|
||||
|
||||
predictPoint { |buffer, action|
|
||||
buffer = this.prEncodeBuffer(buffer);
|
||||
this.prSendMsg(\predictPoint, [buffer], action,
|
||||
[number(FluidMessageResponse,_,_)]);
|
||||
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.predictPointMsg(buffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer|
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, this.numNeighbours, this.weight,
|
||||
this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,81 +1,52 @@
|
||||
FluidLabelSetExistsError : Exception{
|
||||
}
|
||||
|
||||
FluidLabelSet : FluidManipulationClient {
|
||||
|
||||
var <id;
|
||||
classvar serverCaches;
|
||||
|
||||
*initClass {
|
||||
serverCaches = FluidServerCache.new;
|
||||
}
|
||||
|
||||
*at{ |server, name|
|
||||
^serverCaches.tryPerform(\at, server, name)
|
||||
}
|
||||
|
||||
*new { |server,name|
|
||||
serverCaches.at(server,name) !? {
|
||||
FluidLabelSetExistsError("A FluidLabelSet called % already exists.".format(name)).throw;
|
||||
};
|
||||
^super.new(server,FluidManipulationClient.prServerString(name))!?{|inst|inst.init(name);inst}
|
||||
}
|
||||
FluidLabelSet : FluidDataObject {
|
||||
|
||||
init { |name|
|
||||
this.baseinit(FluidManipulationClient.prServerString(name));
|
||||
id = name;
|
||||
this.cache;
|
||||
}
|
||||
addLabelMsg{|identifier,label|
|
||||
^this.prMakeMsg(\addLabel,id,identifier.asSymbol,label.asSymbol);
|
||||
}
|
||||
|
||||
cache {
|
||||
serverCaches.initCache(server);
|
||||
serverCaches.put(server,id,this);
|
||||
addLabel{|identifier, label, action|
|
||||
actions[\addLabel] = [nil, action];
|
||||
this.prSendMsg(this.addLabelMsg(identifier,label));
|
||||
}
|
||||
|
||||
asString {
|
||||
^"FluidLabelSet(%)".format(id).asString;
|
||||
}
|
||||
updateLabelMsg{|identifier, label|
|
||||
^this.prMakeMsg(\updateLabel, id, identifier.asSymbol, label.asSymbol);
|
||||
}
|
||||
|
||||
asSymbol {
|
||||
^id
|
||||
updateLabel{|identifier, label, action|
|
||||
actions[\updateLabel] = [nil,action];
|
||||
this.prSendMsg(this.updateLabelMsg(identifier,label));
|
||||
}
|
||||
|
||||
*asUGenInput { |input|
|
||||
var ascii = input.asString.ascii;
|
||||
^[ascii.size].addAll(ascii)
|
||||
}
|
||||
getLabelMsg{|identifier|
|
||||
^this.prMakeMsg(\getLabel, id, identifier.asSymbol);
|
||||
}
|
||||
|
||||
addLabel{|id, label, action|
|
||||
this.prSendMsg(\addLabel, [id.asString, label.asString],action);
|
||||
getLabel{|identifier, action|
|
||||
actions[\getLabel] = [string(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.getLabelMsg(identifier));
|
||||
}
|
||||
|
||||
updateLabel{|id, label, action|
|
||||
this.prSendMsg(\updateLabel, [id.asString, label.asString],action);
|
||||
}
|
||||
deleteLabelMsg{|identifier, action|
|
||||
^this.prMakeMsg(\deleteLabel, id, identifier.asSymbol);
|
||||
}
|
||||
|
||||
getLabel{|id, action|
|
||||
this.prSendMsg(\getLabel, [id.asString], action,[string(FluidMessageResponse,_,_)]);
|
||||
deleteLabel{|identifier, action|
|
||||
actions[\deleteLabel] = [nil, action];
|
||||
this.prSendMsg(this.deleteLabelMsg(identifier));
|
||||
}
|
||||
|
||||
deleteLabel{|id, action|
|
||||
this.prSendMsg(\deleteLabel, [id.asString],action);
|
||||
}
|
||||
clearMsg { ^this.prMakeMsg(\clear,id); }
|
||||
|
||||
clear {|action|
|
||||
this.prSendMsg(\clear,[], action);
|
||||
}
|
||||
|
||||
free {|action|
|
||||
serverCaches.remove(server, id);
|
||||
super.free;
|
||||
}
|
||||
clear { |action|
|
||||
actions[\clear] = [nil,action];
|
||||
this.prSendMsg(this.clearMsg);
|
||||
}
|
||||
|
||||
*freeAll {|server|
|
||||
serverCaches.do(server,{|x| x.free;});
|
||||
}
|
||||
printMsg { ^this.prMakeMsg(\print,id); }
|
||||
|
||||
print { |action|
|
||||
action ?? {action = postit};
|
||||
this.prSendMsg(\print,[], action, [string(FluidMessageResponse,_,_)]);
|
||||
print { |action=(postResponse)|
|
||||
actions[\print] = [string(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.printMsg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,103 +1,151 @@
|
||||
FluidMLPRegressor : FluidRTDataClient {
|
||||
FluidMLPRegressor : FluidRealTimeModel {
|
||||
|
||||
const <identity = 0;
|
||||
const <sigmoid = 1;
|
||||
const <relu = 2;
|
||||
const <tanh = 3;
|
||||
|
||||
var <>hidden, <>activation, <>outputActivation, <>tapIn, <>tapOut, <>maxIter, <>learnRate, <>momentum, <>batchSize, <>validation;
|
||||
|
||||
*new {|server, hidden = #[3,3] , activation = 2, outputActivation = 0, tapIn = 0, tapOut = -1,maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
||||
var hiddenCtrlLabels;
|
||||
hidden = [hidden.size]++hidden;
|
||||
|
||||
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i};
|
||||
|
||||
^super.new1(server,
|
||||
[hiddenCtrlLabels,hidden].lace ++
|
||||
[
|
||||
\activation,activation,
|
||||
\outputActivation, outputActivation,
|
||||
\tapIn, tapIn,
|
||||
\tapOut, tapOut,
|
||||
\maxIter, maxIter,
|
||||
\learnRate,learnRate,
|
||||
\momentum, momentum,
|
||||
\batchsize,batchSize,
|
||||
\validation,validation,
|
||||
])
|
||||
|
||||
^super.new(server, [hidden.size] ++ hidden ++ [activation, outputActivation, tapIn, tapOut, maxIter, learnRate, momentum, batchSize, validation])
|
||||
.hidden_(hidden)
|
||||
.activation_(activation)
|
||||
.outputActivation_(outputActivation)
|
||||
.tapIn_(tapIn)
|
||||
.tapOut_(tapOut)
|
||||
.maxIter_(maxIter)
|
||||
.learnRate_(learnRate)
|
||||
.momentum_(momentum)
|
||||
.batchSize_(batchSize)
|
||||
.validation_(validation);
|
||||
}
|
||||
|
||||
clear{ |action|
|
||||
this.prSendMsg(\clear,action:action);
|
||||
prGetParams{
|
||||
^[this.hidden.size] ++ this.hidden ++ [this.activation, this.outputActivation, this.tapIn, this.tapOut, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1]
|
||||
}
|
||||
|
||||
clearMsg{ ^this.prMakeMsg(\clear, id) }
|
||||
|
||||
clear{ |action|
|
||||
actions[\clear] = [nil, action];
|
||||
this.prSendMsg(this.clearMsg);
|
||||
}
|
||||
|
||||
fitMsg{|sourceDataSet, targetDataSet|
|
||||
^this.prMakeMsg(\fit,id,sourceDataSet.id, targetDataSet.id);
|
||||
}
|
||||
|
||||
fit{|sourceDataSet, targetDataSet, action|
|
||||
this.prSendMsg(\fit,
|
||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
||||
action,numbers(FluidMessageResponse,_,1,_)
|
||||
);
|
||||
actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.fitMsg(sourceDataSet,targetDataSet));
|
||||
}
|
||||
|
||||
predict{ |sourceDataSet, targetDataSet, action|
|
||||
this.prSendMsg(\predict,
|
||||
[sourceDataSet.asSymbol, targetDataSet.asSymbol],
|
||||
action);
|
||||
predictMsg{|sourceDataSet, targetDataSet|
|
||||
^this.prMakeMsg(\predict,id,sourceDataSet.id, targetDataSet.id);
|
||||
}
|
||||
|
||||
predict{|sourceDataSet, targetDataSet, action|
|
||||
actions[\predict] = [nil,action];
|
||||
this.prSendMsg(this.predictMsg(sourceDataSet,targetDataSet));
|
||||
}
|
||||
|
||||
|
||||
predictPointMsg { |sourceBuffer, targetBuffer|
|
||||
^this.prMakeMsg(\predictPoint,id,
|
||||
this.prEncodeBuffer(sourceBuffer),
|
||||
this.prEncodeBuffer(targetBuffer),
|
||||
["/b_query", targetBuffer.asUGenInput]);
|
||||
}
|
||||
|
||||
predictPoint { |sourceBuffer, targetBuffer, action|
|
||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
||||
targetBuffer = this.prEncodeBuffer(targetBuffer);
|
||||
this.prSendMsg(\predictPoint,
|
||||
[sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action,outputBuffers:[targetBuffer]);
|
||||
actions[\predictPoint] = [nil,{action.value(targetBuffer)}];
|
||||
this.predictPointMsg(sourceBuffer, targetBuffer).postln;
|
||||
this.prSendMsg(this.predictPointMsg(sourceBuffer, targetBuffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer, tapIn = 0, tapOut = -1|
|
||||
var params;
|
||||
tapIn = tapIn ? this.tapIn;
|
||||
tapOut = tapOut ? this.tapOut;
|
||||
|
||||
this.tapIn_(tapIn).tapOut_(tapOut);
|
||||
|
||||
params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer)];
|
||||
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, *params);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
FluidMLPClassifier : FluidRTDataClient {
|
||||
FluidMLPClassifier : FluidRealTimeModel {
|
||||
|
||||
const <identity = 0;
|
||||
const <sigmoid = 1;
|
||||
const <relu = 2;
|
||||
const <tanh = 3;
|
||||
|
||||
var <>hidden, <>activation, <> maxIter, <>learnRate, <> momentum, <>batchSize, <>validation;
|
||||
|
||||
*new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
|
||||
var hiddenCtrlLabels;
|
||||
hidden = [hidden.size]++hidden;
|
||||
|
||||
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i};
|
||||
|
||||
^super.new1(server,
|
||||
[hiddenCtrlLabels,hidden].lace ++
|
||||
[
|
||||
\activation,activation,
|
||||
\maxIter, maxIter,
|
||||
\learnRate,learnRate,
|
||||
\momentum, momentum,
|
||||
\batchsize,batchSize,
|
||||
\validation,validation,
|
||||
])
|
||||
^super.new(server,[hidden.size] ++ hidden ++ [activation, maxIter, learnRate, momentum, batchSize, validation])
|
||||
.hidden_(hidden)
|
||||
.activation_(activation)
|
||||
.maxIter_(maxIter)
|
||||
.learnRate_(learnRate)
|
||||
.momentum_(momentum)
|
||||
.batchSize_(batchSize)
|
||||
.validation_(validation);
|
||||
}
|
||||
|
||||
prGetParams{
|
||||
^[ this.hidden.size] ++ this.hidden ++ [this.activation, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1];
|
||||
}
|
||||
|
||||
clearMsg{ ^this.prMakeMsg(\clear,id) }
|
||||
|
||||
clear{ |action|
|
||||
this.prSendMsg(\clear,action:action);
|
||||
actions[\clear] = [nil,action];
|
||||
this.prSendMsg(this.clearMsg);
|
||||
}
|
||||
|
||||
fitMsg{|sourceDataSet, targetLabelSet|
|
||||
^this.prMakeMsg(\fit,id,sourceDataSet.id, targetLabelSet.id);
|
||||
}
|
||||
|
||||
fit{|sourceDataSet, targetLabelSet, action|
|
||||
this.prSendMsg(\fit,
|
||||
[sourceDataSet.asSymbol, targetLabelSet.asSymbol],
|
||||
action,numbers(FluidMessageResponse,_,1,_)
|
||||
);
|
||||
actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.fitMsg(sourceDataSet,targetLabelSet));
|
||||
}
|
||||
|
||||
predictMsg{|sourceDataSet, targetLabelSet|
|
||||
^this.prMakeMsg(\predict,id,sourceDataSet.id, targetLabelSet.id);
|
||||
}
|
||||
|
||||
predict{ |sourceDataSet, targetLabelSet, action|
|
||||
this.prSendMsg(\predict,
|
||||
[sourceDataSet.asSymbol, targetLabelSet.asSymbol],
|
||||
action);
|
||||
actions[\predict]=[nil,action];
|
||||
this.prSendMsg(this.predictMsg(sourceDataSet,targetLabelSet));
|
||||
}
|
||||
|
||||
predictPointMsg { |sourceBuffer|
|
||||
^this.prMakeMsg(\predictPoint,id,this.prEncodeBuffer(sourceBuffer))
|
||||
}
|
||||
|
||||
predictPoint { |sourceBuffer, action|
|
||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
||||
this.prSendMsg(\predictPoint,
|
||||
[sourceBuffer], action, string(FluidMessageResponse,_,_));
|
||||
actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
|
||||
this.prSendMsg(this.predictPointMsg(sourceBuffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer|
|
||||
|
||||
var params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer),
|
||||
this.prEncodeBuffer(outputBuffer)];
|
||||
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, *params);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,31 +1,68 @@
|
||||
FluidNormalize : FluidRTDataClient {
|
||||
FluidNormalize : FluidRealTimeModel {
|
||||
|
||||
var <>min, <>max, <>invert;
|
||||
|
||||
*new {|server, min = 0, max = 1, invert = 0|
|
||||
^super.new1(server,[\min,min,\max,max, \invert, invert]);
|
||||
^super.new(server,[min,max,invert])
|
||||
.min_(min).max_(max).invert_(invert);
|
||||
}
|
||||
|
||||
prGetParams{
|
||||
^[this.min,this.max,this.invert,-1,-1];
|
||||
}
|
||||
|
||||
|
||||
fitMsg{|dataSet|
|
||||
^this.prMakeMsg(\fit,id,dataSet.id)
|
||||
}
|
||||
|
||||
fit{|dataSet, action|
|
||||
this.prSendMsg(\fit,[dataSet.asSymbol], action);
|
||||
actions[\fit] = [nil,action];
|
||||
this.prSendMsg(this.fitMsg(dataSet));
|
||||
}
|
||||
|
||||
transformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||
}
|
||||
|
||||
transform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\transform,
|
||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
||||
);
|
||||
actions[\transform] = [nil,action];
|
||||
this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet));
|
||||
}
|
||||
|
||||
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
||||
}
|
||||
|
||||
fitTransform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\fitTransform,
|
||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
||||
);
|
||||
actions[\fitTransform] = [nil,action];
|
||||
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
||||
}
|
||||
|
||||
transformPointMsg{|sourceBuffer, destBuffer|
|
||||
^this.prMakeMsg(\transformPoint,id,
|
||||
this.prEncodeBuffer(sourceBuffer),
|
||||
this.prEncodeBuffer(destBuffer),
|
||||
["/b_query",destBuffer.asUGenInput]
|
||||
);
|
||||
}
|
||||
|
||||
transformPoint{|sourceBuffer, destBuffer, action|
|
||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
||||
this.prSendMsg(\transformPoint,
|
||||
[sourceBuffer, destBuffer], action,
|
||||
outputBuffers:[destBuffer]
|
||||
);
|
||||
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
||||
this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer,min,max,invert|
|
||||
|
||||
min = min ? this.min;
|
||||
max = max ? this.max;
|
||||
invert = invert ? this.invert;
|
||||
|
||||
this.min_(min).max_(max).invert_(invert);
|
||||
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, this.min, this.max, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1,24 +1,62 @@
|
||||
FluidPCA : FluidRTDataClient {
|
||||
FluidPCA : FluidRealTimeModel{
|
||||
|
||||
*new {|server, numDimensions = 2|
|
||||
^super.new1(server,[\numDimensions,numDimensions]);
|
||||
}
|
||||
var <>numDimensions;
|
||||
|
||||
*new {|server, numDimensions = 2|
|
||||
^super.new(server,[numDimensions]).numDimensions_(numDimensions);
|
||||
}
|
||||
|
||||
prGetParams{
|
||||
^[numDimensions,-1,-1];
|
||||
}
|
||||
|
||||
fitMsg{|dataSet|
|
||||
^this.prMakeMsg(\fit,id, dataSet.id);
|
||||
}
|
||||
|
||||
fit{|dataSet, action|
|
||||
this.prSendMsg(\fit,[dataSet.asSymbol], action);
|
||||
actions[\fit] = [nil, action];
|
||||
this.prSendMsg(this.fitMsg(dataSet));
|
||||
}
|
||||
|
||||
transformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\transform, id, sourceDataSet.id, destDataSet.id);
|
||||
}
|
||||
|
||||
transform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\transform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]);
|
||||
actions[\transform] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||
}
|
||||
|
||||
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\fitTransform,id, sourceDataSet.id, destDataSet.id);
|
||||
}
|
||||
|
||||
fitTransform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\fitTransform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]);
|
||||
actions[\fitTransform] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet));
|
||||
}
|
||||
|
||||
transformPointMsg{|sourceBuffer, destBuffer|
|
||||
^this.prMakeMsg(\transformPoint,id,
|
||||
this.prEncodeBuffer(sourceBuffer),
|
||||
this.prEncodeBuffer(destBuffer),
|
||||
["/b_query",destBuffer.asUGenInput]
|
||||
);
|
||||
}
|
||||
|
||||
transformPoint{|sourceBuffer, destBuffer, action|
|
||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
||||
this.prSendMsg(\transformPoint,[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]);
|
||||
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
||||
this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer,numDimensions|
|
||||
|
||||
numDimensions = numDimensions ? this.numDimensions;
|
||||
this.numDimensions_(numDimensions);
|
||||
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, this.numDimensions, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
FluidProxyUgen : UGen {
|
||||
|
||||
var <>pluginname;
|
||||
|
||||
*kr { |pluginname...args|
|
||||
pluginname.postln;
|
||||
^this.new1('control', pluginname,*args)
|
||||
}
|
||||
|
||||
init { |pluginname...args|
|
||||
this.pluginname = pluginname;
|
||||
inputs = args;
|
||||
rate = 'control';
|
||||
}
|
||||
|
||||
name{
|
||||
^pluginname.asString;
|
||||
}
|
||||
|
||||
poll{ |trig = 10, label, trigid = -1|
|
||||
^super.poll(trig, label ? this.name, trigid)
|
||||
}
|
||||
}
|
||||
|
||||
FluidServerCache {
|
||||
|
||||
var <cache;
|
||||
|
||||
*new{ ^super.new.init }
|
||||
|
||||
init{
|
||||
cache = IdentityDictionary.new;
|
||||
}
|
||||
|
||||
do { |server, func|
|
||||
cache[server]!?{cache[server].do{|x|func.value(x)}}
|
||||
}
|
||||
|
||||
doAll {|func|
|
||||
cache.do{|subCache|
|
||||
subCache.do{|item|
|
||||
func.value(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
postln{
|
||||
cache.postln;
|
||||
}
|
||||
|
||||
at { |server,id|
|
||||
^cache[server].tryPerform(\at,id)
|
||||
}
|
||||
|
||||
includesKey{|server,key|
|
||||
^cache[server].tryPerform(\includesKey,key)
|
||||
}
|
||||
|
||||
put {|server,id,x|
|
||||
cache[server][id] = x;
|
||||
}
|
||||
|
||||
remove { |server,id|
|
||||
cache[server]!? {cache[server].removeAt(id)};
|
||||
}
|
||||
|
||||
initCache {|server|
|
||||
cache[server] ?? {
|
||||
cache[server] = IdentityDictionary.new;
|
||||
NotificationCenter.register(server,\newAllocators,this,
|
||||
{
|
||||
this.clearCache(server);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
clearCache { |server|
|
||||
cache[server] !?
|
||||
{
|
||||
cache[server].do(_.free);
|
||||
cache.removeAt(server)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,299 @@
|
||||
FluidServerObject
|
||||
{
|
||||
classvar serverCaches;
|
||||
classvar count;
|
||||
classvar persistent = true;
|
||||
var <server,<id;
|
||||
|
||||
*initClass {
|
||||
// serverCaches = FluidServerCache.new;
|
||||
serverCaches = IdentityDictionary.new;
|
||||
count = 0;
|
||||
}
|
||||
|
||||
*initCache {|server|
|
||||
serverCaches[this] ?? {serverCaches[this] = FluidServerCache.new};
|
||||
serverCaches[this].initCache(server);
|
||||
NotificationCenter.register(server,\newAllocators,this,{ count = 0; });
|
||||
}
|
||||
|
||||
*newMsg{|id, params|
|
||||
params = params !? {params.collect(_.asUGenInput)};
|
||||
// ("Newms"++params).postln;
|
||||
^['/cmd',this.objectClassName ++ '/new',id] ++ params
|
||||
}
|
||||
|
||||
*new{ |server, id, params, action, callNew = true|
|
||||
var newObj;
|
||||
server ?? {server = Server.default};
|
||||
if(server.serverRunning.not){"Server not running".warn};
|
||||
id !? { id = id.asInteger }
|
||||
?? { id = count; count = count + 1; };
|
||||
newObj = super.newCopyArgs(server,id,action);
|
||||
// params.postln;
|
||||
if(callNew) {server.listSendMsg(this.newMsg(id,params))};
|
||||
^newObj.cache
|
||||
}
|
||||
|
||||
cache {
|
||||
this.class.initCache(server);
|
||||
serverCaches[this.class].put(server,this.id,this);
|
||||
}
|
||||
|
||||
uncache{
|
||||
serverCaches[this.class].remove(server,id);
|
||||
}
|
||||
|
||||
prMakeMsg{|msg,id...args|
|
||||
^['/cmd',"%/%".format(this.class.objectClassName,msg),id].addAll(args);
|
||||
}
|
||||
|
||||
freeMsg {
|
||||
var msg;
|
||||
id ?? {" % already freed".format(this.class.name).warn; ^nil};
|
||||
this.uncache;
|
||||
msg = this.prMakeMsg(\free,id);
|
||||
id = nil;
|
||||
^msg;
|
||||
}
|
||||
|
||||
free{
|
||||
var msg = this.freeMsg;
|
||||
msg !? {server.listSendMsg(msg)} ?? {^nil};
|
||||
}
|
||||
|
||||
asUGenInput{ ^id }
|
||||
|
||||
asString {
|
||||
^"%(%)".format(this.class.name,id).asString;
|
||||
}
|
||||
|
||||
asSymbol {
|
||||
^id.asSymbol
|
||||
}
|
||||
|
||||
*objectClassName { ^this.name.asSymbol }
|
||||
|
||||
}
|
||||
|
||||
FluidBufProcessor : FluidServerObject
|
||||
{
|
||||
var <processAction;
|
||||
var <outputBuffers;
|
||||
var <freeWhenDone;
|
||||
classvar responder;
|
||||
|
||||
*cmdPeriod {
|
||||
serverCaches[this].doAll{|processor| processor.free; };
|
||||
count = 0;
|
||||
}
|
||||
|
||||
*initCache {|server|
|
||||
// "initcache".postln;
|
||||
// this.done.postln;
|
||||
super.initCache(server);
|
||||
CmdPeriod.add(this);
|
||||
if(serverCaches[this].includesKey(server,\processResponder).not)
|
||||
{
|
||||
serverCaches[this].put(server,\processResponder,OSCFunc({|m|
|
||||
var id = m.last.asInteger;
|
||||
// "I'm in the pizza hut".postln;
|
||||
serverCaches[this].at(server,id) !? {|p|
|
||||
// "I'm in the taco bell".postln ;
|
||||
p!?{
|
||||
p.processAction!?{|a|
|
||||
var bufs = p.outputBuffers;
|
||||
|
||||
bufs = bufs.collect{|b|
|
||||
if(b.isKindOf(Buffer))
|
||||
{b}
|
||||
{Buffer.cachedBufferAt(server,b)};
|
||||
};
|
||||
a.valueArray(valueArray(bufs));
|
||||
};
|
||||
if(p.freeWhenDone){p.free};
|
||||
}
|
||||
}
|
||||
},this.done ,server.addr).fix)
|
||||
}
|
||||
}
|
||||
|
||||
*new {|server,id,outputBuffers|
|
||||
^super.new(server,id, nil, nil,false).init(outputBuffers);
|
||||
}
|
||||
|
||||
init{ |ob|
|
||||
outputBuffers = ob;
|
||||
}
|
||||
|
||||
*done {
|
||||
^"/%/process".format(this.objectClassName);
|
||||
}
|
||||
|
||||
wait {
|
||||
var condition = Condition.new;
|
||||
OSCFunc({
|
||||
condition.unhang;
|
||||
},this.class.done,server.addr).oneShot;
|
||||
condition.hang;
|
||||
}
|
||||
|
||||
processMsg {|params|
|
||||
var msg;
|
||||
var completionMsg = outputBuffers !? {
|
||||
[["/sync"]] ++ outputBuffers.collect{|b| ["/b_query", b.asUGenInput]}
|
||||
} ?? {[]};
|
||||
|
||||
// completionMsg.postln;
|
||||
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||
msg = this.prMakeMsg(\processNew,id).addAll(params).add(completionMsg);
|
||||
// msg.postln;
|
||||
^msg;
|
||||
}
|
||||
|
||||
processList { |params,shouldFree,action|
|
||||
freeWhenDone = shouldFree;
|
||||
processAction = action;
|
||||
params = params.collect(_.asUGenInput);
|
||||
server.listSendMsg(this.processMsg(params));
|
||||
}
|
||||
|
||||
cancelMsg{
|
||||
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||
^this.prMakeMsg(\cancel, id);
|
||||
}
|
||||
|
||||
cancel{
|
||||
server.listSendMsg(this.cancelMsg);
|
||||
}
|
||||
|
||||
kr{ ^FluidProxyUgen.kr(this.objectClassName ++ "Monitor",id) }
|
||||
}
|
||||
|
||||
FluidOSCPatternInversion : OSCMessageDispatcher
|
||||
{
|
||||
value {|msg, time, addr, recvPort|
|
||||
var msgpath = msg[0];
|
||||
active.keysValuesDo({|key, func|
|
||||
if(msgpath.matchOSCAddressPattern(key), {func.value(msg, time, addr, recvPort);});
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FluidDataObject : FluidServerObject
|
||||
{
|
||||
classvar postResponse;
|
||||
|
||||
var <actions;
|
||||
|
||||
*initClass{
|
||||
postResponse = _.postln;
|
||||
}
|
||||
|
||||
*initCache{ |server|
|
||||
super.initCache(server);
|
||||
if(serverCaches[this].includesKey(server,\messageResponder).not)
|
||||
{
|
||||
serverCaches[this].put(server,\messageResponder,OSCFunc.new({|m|
|
||||
var id = m[2].asInteger;
|
||||
var method;
|
||||
// "I'm in the maccydees".postln;
|
||||
serverCaches[this].at(server,id) !? { |p|
|
||||
// "I'm in the burger king".postln ;
|
||||
// m.postln;
|
||||
method = m[0].asString.findRegexp("/"++this.name++"/(.*)")[1][1].asSymbol;
|
||||
/* p.postln;
|
||||
p.actions[method].postln;*/
|
||||
p.actions[method] !? {|a|
|
||||
//two items: parser and action
|
||||
var parser = a[0];
|
||||
var action = a[1];
|
||||
var result = FluidMessageResponse.collectArgs(parser,m[3..]);
|
||||
action.value(result);
|
||||
}
|
||||
}
|
||||
},'/' ++ this.objectClassName ++ '/*',server.addr, dispatcher:FluidOSCPatternInversion.new).fix)
|
||||
}
|
||||
}
|
||||
|
||||
*new{|server...args|
|
||||
// args.flatten.postln;
|
||||
^super.new(server,params:args.flatten).init;
|
||||
}
|
||||
|
||||
*cachedInstanceAt{|server,id|
|
||||
this.initCache;
|
||||
^serverCaches[this].at(server,id);
|
||||
}
|
||||
|
||||
init {
|
||||
actions = IdentityDictionary.new;
|
||||
}
|
||||
|
||||
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
|
||||
|
||||
prSendMsg {|msg| server !? {server.listSendMsg(msg)};}
|
||||
|
||||
colsMsg { ^this.prMakeMsg(\cols,id);}
|
||||
|
||||
cols{ |action=(postResponse)|
|
||||
actions[\cols] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.colsMsg)
|
||||
}
|
||||
|
||||
readMsg { |filename| ^this.prMakeMsg(\read,id,filename.asString);}
|
||||
|
||||
read{|filename, action|
|
||||
actions[\read] = [nil,action];
|
||||
this.prSendMsg(this.readMsg(filename));
|
||||
}
|
||||
|
||||
writeMsg {|filename|
|
||||
// ^['/cmd',this.class.name ++ '/write',id,filename.asString]
|
||||
^this.prMakeMsg(\write,id,filename.asString);
|
||||
}
|
||||
|
||||
write{|filename, action|
|
||||
actions[\write] = [nil,action];
|
||||
this.prSendMsg(this.writeMsg(filename));
|
||||
}
|
||||
|
||||
sizeMsg{
|
||||
// ^['/cmd',this.class.name ++ '/size',id]
|
||||
^this.prMakeMsg(\size,id);
|
||||
}
|
||||
|
||||
size {|action=(postResponse)|
|
||||
actions[\size] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||
this.prSendMsg(this.sizeMsg);
|
||||
}
|
||||
}
|
||||
|
||||
FluidModelObject : FluidDataObject
|
||||
{
|
||||
prGetParams{
|
||||
"Subclass should provide this".throw;
|
||||
}
|
||||
|
||||
prUpdateStateMsg{
|
||||
var params = this.prGetParams.value.collect(_.asUGenInput);
|
||||
^this.prMakeMsg(\setParams,id) ++ params;
|
||||
}
|
||||
|
||||
prSendMsg {|msg|
|
||||
server !? { server.bind(
|
||||
{
|
||||
super.prSendMsg(this.prUpdateStateMsg);
|
||||
super.prSendMsg(msg);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FluidRealTimeModel : FluidModelObject
|
||||
{
|
||||
*new{ |server, params|
|
||||
^super.new(server,params++[-1,-1]);
|
||||
}
|
||||
}
|
||||
@ -1,29 +1,58 @@
|
||||
FluidStandardize : FluidRTDataClient {
|
||||
*new {|server, invert = 0|
|
||||
^super.new1(server,[\invert, invert]);
|
||||
FluidStandardize : FluidRealTimeModel {
|
||||
|
||||
var <>invert;
|
||||
|
||||
*new {|server, invert = 0|
|
||||
^super.new(server,[invert]).invert_(invert);
|
||||
}
|
||||
|
||||
fit{|dataSet, action|
|
||||
this.prSendMsg(\fit, [dataSet.asSymbol], action);
|
||||
prGetParams{
|
||||
^[this.invert, -1, 1];
|
||||
}
|
||||
|
||||
fitMsg{|dataSet|
|
||||
^this.prMakeMsg(\fit,id,dataSet.id);
|
||||
}
|
||||
|
||||
fit{|dataSet, action|
|
||||
actions[\fit] = [nil, action];
|
||||
this.prSendMsg(this.fitMsg(dataSet));
|
||||
}
|
||||
|
||||
transformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||
}
|
||||
|
||||
transform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\transform,
|
||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
||||
);
|
||||
actions[\transform] = [nil,action];
|
||||
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||
}
|
||||
|
||||
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
||||
}
|
||||
|
||||
fitTransform{|sourceDataSet, destDataSet, action|
|
||||
this.prSendMsg(\fitTransform,
|
||||
[sourceDataSet.asSymbol, destDataSet.asSymbol], action
|
||||
);
|
||||
actions[\fitTransform] = [nil,action];
|
||||
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
||||
}
|
||||
|
||||
|
||||
transformPointMsg{|sourceBuffer, destBuffer|
|
||||
^this.prMakeMsg(\transformPoint, id, this.prEncodeBuffer(sourceBuffer), this.prEncodeBuffer(destBuffer),["/b_query",destBuffer.asUGenInput]);
|
||||
}
|
||||
|
||||
transformPoint{|sourceBuffer, destBuffer, action|
|
||||
sourceBuffer = this.prEncodeBuffer(sourceBuffer);
|
||||
destBuffer = this.prEncodeBuffer(destBuffer);
|
||||
this.prSendMsg(\transformPoint,
|
||||
[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]
|
||||
);
|
||||
actions[\transformPoint] = [nil, {action.value(destBuffer)}];
|
||||
this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
|
||||
}
|
||||
|
||||
kr{|trig, inputBuffer,outputBuffer,invert|
|
||||
|
||||
invert = invert ? this.invert;
|
||||
this.invert_(invert);
|
||||
|
||||
^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig),
|
||||
id, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue