Update SC classes

nix
Owen Green 5 years ago
parent 0931042aff
commit d0cbf95550

@ -1,36 +1,43 @@
FluidBufAmpGate : UGen { FluidBufAmpGate : FluidBufProcessor {
*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|
*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)); var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
source = source.asUGenInput; source = source.asUGenInput;
indices = indices.asUGenInput; indices = indices.asUGenInput;
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; ^FluidProxyUgen.kr(\FluidBufAmpGateTrigger,-1, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq,maxSize, trig, blocking);
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
^super.new1(rate, 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| *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 |
^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, action | var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
^FluidNRTProcess.new( source = source ? -1;
server, this, action, [indices] indices = indices ? -1;
).process(
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq ^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;
^FluidNRTProcess.new( ^this.new(
server, this, action, [indices], blocking: 1 server, nil, [indices]
).process( ).processList(
source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq [source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 1],freeWhenDone,action
); );
} }
} }

@ -1,6 +1,6 @@
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; source = source.asUGenInput;
indices = indices.asUGenInput; indices = indices.asUGenInput;
@ -8,28 +8,32 @@ FluidBufAmpSlice : UGen {
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufAmpSlice: Invalid features 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| *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 |
^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, 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( ^this.new(server, nil, [indices]).processList(
server, this, action, [indices] [source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,0],freeWhenDone, action
).process(
source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq
); );
} }
*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( ^this.new(server, nil, [indices]).processList(
server, this, action, [indices], blocking: 1 [source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,1],freeWhenDone, action
).process(
source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq
); );
} }
} }

@ -1,5 +1,10 @@
FluidBufAudioTransport : UGen{ FluidBufAudioTransport : FluidBufProcessor {
*new1 { |rate, source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking=0|
*objectClassName{
^\FluidBufAudioTransp
}
*kr { |source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, 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};
source1.isNil.if {"FluidAudioTransport: Invalid source 1 buffer".throw}; source1.isNil.if {"FluidAudioTransport: Invalid source 1 buffer".throw};
@ -10,31 +15,44 @@ FluidBufAudioTransport : UGen{
destination.isNil.if {"FluidAudioTransport: Invalid destination buffer".throw}; destination.isNil.if {"FluidAudioTransport: Invalid destination buffer".throw};
destination = destination.asUGenInput; destination = destination.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)
^super.new1(rate,source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame1, numFrames1, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize, maxFFTSize, trig,blocking)
^FluidProxyUgen.kr(\FluidBufAudioTransportTrigger,-1, source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame1, numFrames1, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
} }
*kr { |source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
^this.new1(\control, source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame1, numFrames1, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize, trig, blocking);
}
*process { |server, source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
source1.isNil.if {"FluidAudioTransport: Invalid source 1 buffer".throw};
source2.isNil.if {"FluidAudioTransport: Invalid source 2 buffer".throw};
source1 = source1.asUGenInput;
source2 = source2.asUGenInput;
destination.isNil.if {"FluidAudioTransport: Invalid destination buffer".throw};
destination = destination.asUGenInput;
*process { |server, source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, action| ^this.new(
^FluidNRTProcess.new( server, nil, [destination]
server, this, action, [destination] ).processList(
).process( [source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize,maxFFTSize,0], freeWhenDone, action
source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize
) )
} }
*processBlocking { |server, source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, action| *processBlocking { |server, source1, startFrame1 = 0, numFrames1 = -1, startChan1 = 0, numChans1 = -1, source2, startFrame2 = 0, numFrames2 = -1, startChan2 = 0, numChans2 = -1, destination, interpolation=0.0, bandwidth=255, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [destination],blocking:1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process( source1.isNil.if {"FluidAudioTransport: Invalid source 1 buffer".throw};
source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize source2.isNil.if {"FluidAudioTransport: Invalid source 2 buffer".throw};
source1 = source1.asUGenInput;
source2 = source2.asUGenInput;
destination.isNil.if {"FluidAudioTransport: Invalid destination buffer".throw};
destination = destination.asUGenInput;
^this.new(
server, nil, [destination]
).processList(
[source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize,maxFFTSize,1], freeWhenDone, action
) )
} }
} }

@ -1,6 +1,6 @@
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; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
@ -8,26 +8,31 @@ FluidBufCompose : UGen {
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw}; source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
destination.isNil.if {"FluidBufCompose: Invalid destination 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| source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
^FluidNRTProcess.new( destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
server, this, action, [destination], blocking:1
).process(
source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain
);
^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| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, freeWhenDone, action|
^process(
source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain 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|
*kr { |source, destination, axis = 1, trig = 1, blocking = 1|
source = source.asUGenInput; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw}; source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw}; destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
^super.new1(rate, source, destination, axis, trig, blocking);
}
*kr { |source, destination, axis = 1, trig = 1, blocking = 1| ^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, destination, axis, trig, blocking);
^this.new1('control', source, destination, axis, trig, blocking);
} }
*process { |server, source, destination, axis = 1, action| *process { |server, source, destination, axis = 1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [destination], blocking:1 source = source.asUGenInput;
).process( destination = destination.asUGenInput;
source, destination, axis
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| *processBlocking { |server, source, destination, axis = 1, freeWhenDone = true, action|
^process(
source, destination, axis 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,44 +1,50 @@
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| *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|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
source = source.asUGenInput; harmonic = harmonic ? -1;
harmonic = harmonic.asUGenInput; percussive = percussive ? -1;
percussive = percussive.asUGenInput; residual = residual ? -1;
residual = residual.asUGenInput;
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw}; source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^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
//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, 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( var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
'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
); harmonic = harmonic ? -1;
} percussive = percussive ? -1;
residual = residual ? -1;
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
*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|
^FluidNRTProcess.new( ^this.new(
server, this, action, [harmonic, percussive, residual].select{|x| x!= -1} server, nil, [harmonic, percussive, residual].select{|x| x!= -1}
).process( ).processList(
source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize [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|
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};
^FluidNRTProcess.new( ^this.new(
server, this, action, [harmonic, percussive, residual].select{|x| x!= -1}, blocking:1 server, nil, [harmonic, percussive, residual].select{|x| x!= -1}
).process( ).processList(
source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize [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,5 +1,5 @@
FluidBufLoudness : UGen{ FluidBufLoudness : FluidBufProcessor{
*new1 { |rate,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, trig = 1, blocking = 0| *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, trig = 1, blocking = 0|
var maxwindowSize = windowSize.nextPowerOfTwo; var maxwindowSize = windowSize.nextPowerOfTwo;
@ -9,26 +9,40 @@ FluidBufLoudness : UGen{
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize, trig, blocking); ^FluidProxyUgen.kr(\FluidBufLoudnessTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize, trig, blocking);
} }
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, trig = 1, blocking = 0| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, freeWhenDone = true, action|
^this.multiNew('control', source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, trig, blocking );
} var maxwindowSize = windowSize.nextPowerOfTwo;
source = source.asUGenInput;
features = features.asUGenInput;
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action| ^this.new(
^FluidNRTProcess.new( server, nil, [features]
server, this, action, [features] ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,0],freeWhenDone,action
source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [features], blocking: 1 var maxwindowSize = windowSize.nextPowerOfTwo;
).process(
source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize 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, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,1],freeWhenDone,action
); );
} }
} }

@ -1,5 +1,5 @@
FluidBufMFCC : UGen{ FluidBufMFCC : FluidBufProcessor{
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, 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; source = source.asUGenInput;
@ -8,30 +8,38 @@ FluidBufMFCC : UGen{
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw}; source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw}; features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^FluidProxyUgen.kr(\FluidBufMFCCTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq,numCoeffs, windowSize, hopSize, fftSize, maxFFTSize,trig, blocking);
//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 goes to maxNumCoeffs, which is passed numCoeffs in this case
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, numCoeffs, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
} }
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone=true, action |
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize, trig, blocking);
} 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, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, action | source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
^FluidNRTProcess.new( features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
server, this, action, [features]
).process( ^this.new(
source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize server, nil,[features]
).processList(
[source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, numCoeffs,windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, action | *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone=true, action |
^FluidNRTProcess.new(
server, this, action, [features],blocking: 1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process( source = source.asUGenInput;
source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize features = features.asUGenInput;
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
^this.new(
server, nil,[features]
).processList(
[source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq,numCoeffs, windowSize, hopSize, fftSize,maxFFTSize,1],freeWhenDone,action
); );
} }
} }

@ -1,5 +1,6 @@
FluidBufMelBands : UGen { FluidBufMelBands : FluidBufProcessor {
*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|
*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|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
@ -9,30 +10,41 @@ FluidBufMelBands : UGen {
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw}; source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw}; features.isNil.if {"FluidBufMelBands: 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)
// same for maxNumBands which is passed numBands
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); ^FluidProxyUgen.kr(\FluidBufMelBandsTrigger,-1, 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| *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|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, trig, blocking);
} 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};
*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| ^this.new(
^FluidNRTProcess.new( server, nil, [features]
server, this, action, [features] ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action
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, 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, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [features], blocking:1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, normalize, windowSize, hopSize, 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 { FluidBufNMF : FluidBufProcessor //: 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| *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 = source.asUGenInput;
resynth = resynth.asUGenInput;
bases = bases.asUGenInput;
activations = activations.asUGenInput;
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
resynth = resynth ? -1; resynth = resynth ? -1;
bases = bases ? -1; bases = bases ? -1;
activations = activations ? -1; activations = activations ? -1;
^super.new1(rate,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);
}
*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);
} }
*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|
*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|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
resynth = resynth ? -1;
bases = bases ? -1;
activations = activations ? -1;
^FluidNRTProcess.new( ^this.new(
server, this, action, [resynth, bases, activations].select{|x| x!= -1} server,nil,[resynth, bases, activations].select{|x| x!= -1}
).process( ).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize,0],freeWhenDone,action);
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
);
} }
*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}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
resynth = resynth ? -1;
bases = bases ? -1;
activations = activations ? -1;
^FluidNRTProcess.new( ^this.new(
server, this, action, [resynth, bases, activations].select{|x| x!= -1},blocking: 1 server,nil,[resynth, bases, activations].select{|x| x!= -1}
).process( ).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, 1],freeWhenDone,action);
source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
);
} }
} }

@ -1,6 +1,6 @@
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; source = source.asUGenInput;
target = target.asUGenInput; target = target.asUGenInput;
@ -9,26 +9,40 @@ FluidBufNMFCross : UGen{
target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw}; target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw};
output.isNil.if {"FluidBufNMFCross: Invalid output 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| *process { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^this.multiNew(\control, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking);
} 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( ^this.new(
server, this, action, [output].select{|x| x!= -1} server, nil, [output]
).process( ).processList(
source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize [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| *processBlocking { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [output].select{|x| x!= -1}, blocking: 1 source = source.asUGenInput;
).process( target = target.asUGenInput;
source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize 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,5 +1,6 @@
FluidBufNNDSVD : UGen{ FluidBufNNDSVD : FluidBufProcessor{
*new1 { |rate, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking=0|
*kr { |source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw}; source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
@ -8,28 +9,39 @@ FluidBufNNDSVD : UGen{
bases = bases.asUGenInput; bases = bases.asUGenInput;
activations = activations.asUGenInput; activations = activations.asUGenInput;
^super.new1(rate, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking) ^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|
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;
*process { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| ^this.new(
^FluidNRTProcess.new( server, nil, [bases]
server, this, action, [bases] ).processList(
).process( [source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize,0],freeWhenDone, action
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, action| *processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [bases],blocking:1 source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw};
).process( bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw};
source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize 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,5 +1,6 @@
FluidBufNoveltySlice : UGen { FluidBufNoveltySlice : FluidBufProcessor {
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0 |
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, 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};
@ -9,29 +10,41 @@ FluidBufNoveltySlice : UGen {
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, maxFFTSize, kernelSize, filterSize, trig, blocking); ^FluidProxyUgen.kr(\FluidBufNoveltySliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, maxFFTSize, kernelSize, filterSize, trig, blocking);
} }
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1 , blocking = 0| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action |
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, trig, blocking); var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
} source = source.asUGenInput;
indices = indices.asUGenInput;
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, action | ^this.new(
^FluidNRTProcess.new( server, nil, [indices]
server, this, action, [indices] ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, maxFFTSize, kernelSize, filterSize,0],freeWhenDone,action
source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, action | *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.5, filterSize = 1, minSliceLength = 2, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action |
^FluidNRTProcess.new(
server, this, action, [indices], blocking:1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize 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, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, maxFFTSize, kernelSize, filterSize,1],freeWhenDone,action
); );
} }
} }

@ -1,5 +1,5 @@
FluidBufOnsetSlice : UGen { FluidBufOnsetSlice : FluidBufProcessor {
*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| *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|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
@ -9,29 +9,40 @@ FluidBufOnsetSlice : UGen {
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw}; source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw}; indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^FluidProxyUgen.kr(\FluidBufOnsetSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
//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, 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| *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|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, trig, blocking);
} var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
*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| source = source.asUGenInput;
^FluidNRTProcess.new( indices = indices.asUGenInput;
server, this, action, [indices]
).process( source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize 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| *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|
^FluidNRTProcess.new(
server, this, action, [indices], blocking: 1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, 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,6 +1,6 @@
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};
@ -10,30 +10,41 @@ FluidBufPitch : UGen{
source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^FluidProxyUgen.kr(\FluidBufPitchTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
//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);
} }
*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| *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|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, trig, blocking);
} 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| source.isNil.if {"FluidBufPitch: Invalid source buffer".throw};
^FluidNRTProcess.new( features.isNil.if {"FluidBufPitch: Invalid features buffer".throw};
server, this, action, [features]
).process( ^this.new(
source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize 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| *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|
^FluidNRTProcess.new(
server, this, action, [features], blocking: 1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, 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; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; source.isNil.if {"FluidBufScale: Invalid source buffer".throw};
destination.isNil.if {"FluidBufScale: Invalid destination 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);
}
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1| ^FluidProxyUgen.kr(\FluidBufScaleTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking);
^this.new1('control', 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| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [destination], blocking:1 source = source.asUGenInput;
).process( destination = destination.asUGenInput;
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh
); 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| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action|
^process(
source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh 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,38 +1,49 @@
FluidBufSines : UGen{ FluidBufSines : FluidBufProcessor {
*new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, 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; source = source.asUGenInput;
sines = sines.asUGenInput; sines = sines !? {sines.asUGenInput} ?? {-1};
residual = residual.asUGenInput; residual = residual !? {residual.asUGenInput} ?? {-1};
source.isNil.if {"FluidBufSines: Invalid source buffer".throw}; source.isNil.if {"FluidBufSines: Invalid source buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^FluidProxyUgen.multiNew(\FluidBufSinesTrigger, -1, source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
//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, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
} }
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize, trig, blocking);
}
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, action| var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
^FluidNRTProcess.new(
server, this, action, [sines, residual].select{|x| x!= -1} source = source.asUGenInput;
).process( sines = sines !? {sines.asUGenInput} ?? {-1};
source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize residual = residual !? {residual.asUGenInput} ?? {-1};
source.isNil.if {"FluidBufSines: Invalid source buffer".throw};
^this.new(
server, nil, [sines, residual].select{|x| x!= -1}
).processList(
[source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone = true,action
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, action| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines = -1, residual = -1, bandwidth = 76, detectionThreshold = -96, birthLowThreshold = -24, birthHighThreshold = -60, minTrackLen = 15, trackingMethod = 0, trackMagRange = 15, trackFreqRange = 50, trackProb = 0.5, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [sines, residual].select{|x| x!= -1}, blocking: 1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize source = source.asUGenInput;
sines = sines !? {sines.asUGenInput} ?? {-1};
residual = residual !? {residual.asUGenInput} ?? {-1};
source.isNil.if {"FluidBufSines: Invalid source buffer".throw};
^this.new(
server, nil, [sines, residual].select{|x| x!= -1}
).processList(
[source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize,maxFFTSize,1],freeWhenDone,action
); );
} }

@ -1,6 +1,10 @@
FluidBufSpectralShape : UGen { FluidBufSpectralShape : FluidBufProcessor {
*new1{ |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| *objectClassName{
^\FluidBufSpecShp
}
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, 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};
@ -10,33 +14,41 @@ FluidBufSpectralShape : UGen {
source.isNil.if {"FluidBufSpectralShape: Invalid source buffer".throw}; source.isNil.if {"FluidBufSpectralShape: Invalid source buffer".throw};
features.isNil.if {"FluidBufSpectralShape: Invalid features buffer".throw}; features.isNil.if {"FluidBufSpectralShape: Invalid features buffer".throw};
//NB For wrapped versions of NRT classes, we set the params for maxima to ^FluidProxyUgen.kr(\FluidBufSpectralShapeTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
//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, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
} }
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, trig, blocking);
} source = source.asUGenInput;
features = features.asUGenInput;
source.isNil.if {"FluidBufSpectralShape: Invalid source buffer".throw};
features.isNil.if {"FluidBufSpectralShape: Invalid features buffer".throw};
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, action| ^this.new(
^FluidNRTProcess.new( server, nil, [features]
server, this, action, [features] ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, maxFFTSize, 0], freeWhenDone, action
source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, action| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [features], blocking: 1 var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
).process(
source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize source = source.asUGenInput;
features = features.asUGenInput;
source.isNil.if {"FluidBufSpectralShape: Invalid source buffer".throw};
features.isNil.if {"FluidBufSpectralShape: Invalid features buffer".throw};
^this.new(
server, nil, [features]
).processList(
[source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, maxFFTSize, 1], freeWhenDone, action
); );
} }
} }

@ -1,6 +1,6 @@
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; source = source.asUGenInput;
stats = stats.asUGenInput; stats = stats.asUGenInput;
@ -10,27 +10,42 @@ FluidBufStats : UGen{
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw}; stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
weights = weights ? -1; 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| *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|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking);
} 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| ^this.new(
^FluidNRTProcess.new( server, nil, [stats]
server, this, action, [stats] ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights, 0], freeWhenDone, action
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, action| *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|
^FluidNRTProcess.new(
server, this, action, [stats], blocking: 1 source = source.asUGenInput;
).process( stats = stats.asUGenInput;
source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights 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{
*kr {|result, time, trig = 1, blocking = 0|
*new1 {|rate, result, time, trig = 1, blocking = 0 |
result = result.asUGenInput; result = result.asUGenInput;
result.isNil.if {this.class.name+": Invalid output buffer".throw}; result.isNil.if {this.class.name+": Invalid output buffer".throw};
^super.new1(rate, result, time, trig, blocking);
^FluidProxyUgen.kr(\FluidBufThreadDemoTrigger, -1, result, time, trig, blocking);
} }
*process { |server, result, time = 1000, freeWhenDone = true, action|
*kr {|result, time, trig = 1, blocking = 0|
^this.new1(\control, result, time, trig, blocking);
}
*process { |server, result, time = 1000, action| result ?? {this.class.name+": Invalid output buffer".throw};
^FluidNRTProcess.new(
server, this, action, [result] ^this.new(
).process( server, nil, [result]
result, time ).processList(
[result.asUGenInput, time, 0], freeWhenDone, action
); );
} }
*processBlocking { |server, result, time = 1000, action| *processBlocking { |server, result, time = 1000, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [result], blocking: 1 result ?? {this.class.name+": Invalid output buffer".throw};
).process(
result, time ^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; source = source.asUGenInput;
destination = destination.asUGenInput; destination = destination.asUGenInput;
source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; source.isNil.if {"FluidBufThresh: Invalid source buffer".throw};
destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw};
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
}
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1| ^FluidProxyUgen.kr(\FluidBufThreshTrigger, -1, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
^this.new1('control', source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking);
} }
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action, [destination], blocking:1 source = source.asUGenInput;
).process( destination = destination.asUGenInput;
source, startFrame, numFrames, startChan, numChans, destination, threshold
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| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action|
^process(
source, startFrame, numFrames, startChan, numChans, destination, threshold 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,5 +1,8 @@
FluidBufTransientSlice : UGen{ FluidBufTransientSlice : FluidBufProcessor {
*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|
*objectClassName{^\FluidBufTrSlice}
*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|
source = source.asUGenInput; source = source.asUGenInput;
indices = indices.asUGenInput; indices = indices.asUGenInput;
@ -7,24 +10,34 @@ FluidBufTransientSlice : UGen{
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking); ^FluidProxyUgen.kr(\FluidBufTransientSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking);
} }
*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| *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|
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking);
} source = source.asUGenInput;
indices = indices.asUGenInput;
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
*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| ^this.new(
^FluidNRTProcess.new( server, nil,[indices]
server, this, action,[indices] ).processList([source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength,0], freeWhenDone, action
).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, 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, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action,[indices], blocking: 1 source = source.asUGenInput;
).process(source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength 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; source = source.asUGenInput;
transients = transients.asUGenInput; transients = transients ? -1;
residual = residual.asUGenInput; 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| source = source.asUGenInput;
^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking); 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| ^this.new(
^FluidNRTProcess.new( server, nil,[transients, residual].select{|x| x!= -1}
server, this, action,[transients, residual].select{|x| x!= -1} ).processList(
).process( [source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,0],freeWhenDone,action
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, 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, freeWhenDone = true, action|
^FluidNRTProcess.new(
server, this, action,[transients, residual].select{|x| x!= -1}, blocking: 1 source = source.asUGenInput;
).process( transients = transients ? -1;
source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength 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 : FluidDataObject
} {
FluidDataSet : FluidManipulationClient {
var <id;
classvar serverCaches;
*initClass {
serverCaches = FluidServerCache.new;
}
*at{ |server, name|
^serverCaches.tryPerform(\at, server, name)
}
*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}
}
init {|name|
this.baseinit(FluidManipulationClient.prServerString(name));
id = name;
this.cache;
}
cache {
serverCaches.initCache(server);
serverCaches.put(server,id,this);
}
*asUGenInput { |input| addPointMsg{|label,buffer|
var ascii = input.asString.ascii; buffer = this.prEncodeBuffer(buffer);
^[ascii.size].addAll(ascii) ^this.prMakeMsg(\addPoint,id,label.asSymbol,buffer);
}
asString {
^"FluidDataSet(%)".format(id).asString;
} }
asSymbol { addPoint{|label, buffer, action|
^id.asSymbol actions[\addPoint] = [nil,action];
this.prSendMsg(this.addPointMsg(label,buffer));
} }
addPoint{|label, buffer, action| getPointMsg{|label,buffer|
buffer = this.prEncodeBuffer(buffer); buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\addPoint,[label.asSymbol,buffer],action); ^this.prMakeMsg(\getPoint,id,label.asSymbol,buffer);
} }
getPoint{|label, buffer, action| getPoint{|label, buffer, action|
actions[\getPoint] = [nil,action];
this.prSendMsg(this.getPointMsg(label,buffer));
}
updatePointMsg{|label,buffer|
buffer = this.prEncodeBuffer(buffer); buffer = this.prEncodeBuffer(buffer);
this.prSendMsg(\getPoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]); ^this.prMakeMsg(\updatePoint,id,label.asSymbol,buffer);
} }
updatePoint{|label, buffer, action| updatePoint{|label, buffer, action|
buffer = this.prEncodeBuffer(buffer); actions[\updatePoint] = [nil,action];
this.prSendMsg(\updatePoint,[label.asSymbol,buffer],action,outputBuffers:[buffer]); this.prSendMsg(this.updatePointMsg(label,buffer));
} }
deletePoint{|label, action| deletePointMsg{|label| ^this.prMakeMsg(\deletePoint,id);}
this.prSendMsg(\deletePoint,[label.asSymbol],action);
deletePoint{|label, buffer, action|
actions[\deletePoint] = [nil,action];
this.prSendMsg(this.deletePointMsg(label));
} }
clearMsg { ^this.prMakeMsg(\clear,id); }
clear { |action| clear { |action|
this.prSendMsg(\clear,[],action); actions[\clear] = [nil,action];
this.prSendMsg(this.clearMsg);
} }
merge{|sourceDataSet, overwrite = 0, action| mergeMsg{|sourceDataSet, overwrite = 0|
this.prSendMsg(\merge, ^this.prMakeMsg(\merge,id,sourceDataSet.asUGenInput,overwrite);
[sourceDataSet.asSymbol, overwrite], action);
} }
print { |action| merge{|sourceDataSet, overwrite = 0, action|
action ?? {action = postit}; actions[\merge] = [nil,action];
this.prSendMsg(\print,[],action,[string(FluidMessageResponse,_,_)]); this.prSendMsg(this.mergeMsg(sourceDataSet,overwrite));
} }
free { printMsg { ^this.prMakeMsg(\print,id); }
serverCaches.remove(server,id);
super.free;
}
*freeAll { |server| print { |action=(postResponse)|
serverCaches.do(server,{|x|x.free;}); actions[\print] = [string(FluidMessageResponse,_,_),action];
this.prSendMsg(this.printMsg);
} }
} }

@ -1,52 +1,84 @@
FluidDataSetQuery : FluidManipulationClient { FluidDataSetQuery : FluidDataObject {
*new {|server| addColumnMsg { |column|
var uid = UniqueID.next; ^this.prMakeMsg(\addColumn,id,column);
^super.new(server,uid)!?{|inst|inst.init(uid);inst}
}
init {|uid|
id = uid;
this.baseinit(uid);
} }
addColumn{|column, action| 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| 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| 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| 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| 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| clear{|action|
this.prSendMsg(\clear, [], action); actions[\clear] = [nil, action];
this.prSendMsg(this.clearMsg);
}
limitMsg{|rows|
^this.prMakeMsg(\limit,id,rows);
} }
limit{|rows, action| 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| 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| 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|
*new1 { |rate, dataset, labelPrefix = "", labelOffset = 0, buf, trig, blocking| var args;
buf ?? {"No input buffer provided".error}; buf ?? {"No input buffer provided".error};
^super.new1(rate,*(FluidManipulationClient.prServerString(dataset.asSymbol) labelPrefix = labelPrefix !? {[labelPrefix.asString.size] ++ labelPrefix.asString.ascii} ?? {0};
++ 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| ^FluidProxyUgen.kr(\FluidDataSetWrTrigger,*args);
^this.new1(\control,dataset,labelPrefix,labelOffset, buf, trig, blocking)
} }
} }

@ -1,41 +1,60 @@
FluidKDTree : FluidRTDataClient { FluidKDTree : FluidRealTimeModel
{
*new {|server,numNeighbours = 1, radius = 0, lookupDataSet = ""| var neighbours,radius,lookup;
var env;
var names = [\numNeighbours, \radius]
++ this.prServerString(lookupDataSet.asSymbol).collect{|x,i|
("lookupDataSet"++i).asSymbol;
};
var values = [numNeighbours, radius] ++ this.prServerString(lookupDataSet.asSymbol); *new{ |server, numNeighbours = 1, radius = 0, lookupDataSet|
var params = [names,values].lace; ^super.new(server,[numNeighbours,radius,lookupDataSet ? -1])
.numNeighbours_(numNeighbours)
.radius_(radius)
.lookupDataSet_(lookupDataSet);
}
numNeighbours_{|k|neighbours = k.asInteger; }
numNeighbours{ ^neighbours; }
/* env = Environment(); radius_{|r| radius = r.asUGenInput;}
synthControls[1..].do{|x| radius{ ^radius; }
env.put(x,0);
};
env.put(\numNeighbours,1); */
^super.new1(server,params); lookupDataSet_{|ds| lookup = ds ? -1; }
/* env, lookupDataSet{|ds| ^ (lookup ? -1) }
[\numNeighbours]++lookupDataSet); */
} prGetParams{^[this.numNeighbours,this.radius,this.lookupDataSet,-1,-1];}
fitMsg{ |dataSet| ^this.prMakeMsg(\fit,this.id,dataSet.id);}
fit{|dataSet,action| 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| kNearest{ |buffer, action|
this.prSendMsg(\kNearest, actions[\kNearest] = [strings(FluidMessageResponse,_,_),action];
[buffer.asUGenInput], action, this.prSendMsg(this.kNearestMsg(buffer));
[strings(FluidMessageResponse,_,_)] }
);
kNearestDistMsg {|buffer|
^this.prMakeMsg(\kNearestDist,id,this.prEncodeBuffer(buffer));
} }
kNearestDist { |buffer, action| kNearestDist { |buffer, action|
this.prSendMsg(\kNearestDist, [buffer.asUGenInput], action, actions[\kNearestDist] = [numbers(FluidMessageResponse,_,nil,_),action];
[numbers(FluidMessageResponse,_,nil,_)] 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| *new {|server, numClusters = 4, maxIter = 100|
^super.new1(server,[\numClusters,numClusters,\maxIter,maxIter]); ^super.new(server,[numClusters,maxIter])
.numClusters_(numClusters)
.maxIter_(maxIter);
}
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));
} }
fit{|dataSet,action| fitPredictMsg{|dataSet, labelSet|
this.prSendMsg(\fit, ^this.prMakeMsg(\fitPredict, id, dataSet.id, labelSet.id)
[dataSet.asSymbol], action,
[numbers(FluidMessageResponse,_,this.numClusters,_)]
);
} }
fitPredict{|dataSet, labelSet,action| fitPredict{|dataSet, labelSet,action|
this.prSendMsg(\fitPredict, actions[\fitPredict] = [
[dataSet.asSymbol,labelSet.asSymbol], numbers(FluidMessageResponse, _, this.numClusters, _),
action,[numbers(FluidMessageResponse,_,this.numClusters,_)] action
); ];
this.prSendMsg(this.fitPredictMsg(dataSet,labelSet));
} }
predict{ |dataSet, labelSet,action| predictMsg{|dataSet, labelSet|
this.prSendMsg(\predict, ^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
[dataSet.asSymbol, labelSet.asSymbol], action, }
[numbers(FluidMessageResponse,_,this.numClusters,_)]
); 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| predictPoint { |buffer, action|
buffer = this.prEncodeBuffer(buffer); actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
this.prSendMsg(\predictPoint, this.prSendMsg(this.predictPointMsg(buffer))
[buffer], action, }
[number(FluidMessageResponse,_,_)]
); 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| *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| fit{|dataSet, labelSet, action|
this.prSendMsg(\fit,[dataSet.asSymbol, labelSet.asSymbol], action); actions[\fit] = [nil,action];
this.prSendMsg(this.fitMsg(dataSet, labelSet));
}
predictMsg{|dataSet, labelSet|
^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id)
} }
predict{|dataSet, labelSet, action| predict{|dataSet, labelSet, action|
this.prSendMsg(\predict, actions[\predict] = [nil, action];
[dataSet.asSymbol, labelSet.asSymbol], this.prSendMsg(this.predictMsg(dataSet, labelSet));
action); }
predictPointMsg{|buffer|
^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer))
} }
predictPoint {|buffer, action| predictPoint {|buffer, action|
buffer = this.prEncodeBuffer(buffer); actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
this.prSendMsg(\predictPoint, this.prSendMsg(this.predictPointMsg(buffer));
[buffer.asUGenInput], action,
[string(FluidMessageResponse,_,_)]
);
} }
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| *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| fit{|sourceDataSet, targetDataSet, action|
this.prSendMsg(\fit, actions[\fit] = [nil,action];
[sourceDataSet.asSymbol, targetDataSet.asSymbol], this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet));
action }
);
predictMsg{ |sourceDataSet, targetDataSet|
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
} }
predict{ |sourceDataSet, targetDataSet,action| predict{ |sourceDataSet, targetDataSet,action|
this.prSendMsg(\predict, actions[\predict] = [nil, action];
[sourceDataSet.asSymbol, targetDataSet.asSymbol], this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
action); }
predictPointMsg { |buffer|
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer));
} }
predictPoint { |buffer, action| predictPoint { |buffer, action|
buffer = this.prEncodeBuffer(buffer); actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
this.prSendMsg(\predictPoint, [buffer], action, this.prSendMsg(this.predictPointMsg(buffer));
[number(FluidMessageResponse,_,_)]); }
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 : FluidDataObject {
}
FluidLabelSet : FluidManipulationClient {
var <id; addLabelMsg{|identifier,label|
classvar serverCaches; ^this.prMakeMsg(\addLabel,id,identifier.asSymbol,label.asSymbol);
*initClass {
serverCaches = FluidServerCache.new;
} }
*at{ |server, name| addLabel{|identifier, label, action|
^serverCaches.tryPerform(\at, server, name) actions[\addLabel] = [nil, action];
this.prSendMsg(this.addLabelMsg(identifier,label));
} }
*new { |server,name| updateLabelMsg{|identifier, label|
serverCaches.at(server,name) !? { ^this.prMakeMsg(\updateLabel, id, identifier.asSymbol, label.asSymbol);
FluidLabelSetExistsError("A FluidLabelSet called % already exists.".format(name)).throw;
};
^super.new(server,FluidManipulationClient.prServerString(name))!?{|inst|inst.init(name);inst}
} }
init { |name| updateLabel{|identifier, label, action|
this.baseinit(FluidManipulationClient.prServerString(name)); actions[\updateLabel] = [nil,action];
id = name; this.prSendMsg(this.updateLabelMsg(identifier,label));
this.cache;
} }
cache { getLabelMsg{|identifier|
serverCaches.initCache(server); ^this.prMakeMsg(\getLabel, id, identifier.asSymbol);
serverCaches.put(server,id,this);
} }
asString { getLabel{|identifier, action|
^"FluidLabelSet(%)".format(id).asString; actions[\getLabel] = [string(FluidMessageResponse,_,_),action];
this.prSendMsg(this.getLabelMsg(identifier));
} }
asSymbol { deleteLabelMsg{|identifier, action|
^id ^this.prMakeMsg(\deleteLabel, id, identifier.asSymbol);
} }
*asUGenInput { |input| deleteLabel{|identifier, action|
var ascii = input.asString.ascii; actions[\deleteLabel] = [nil, action];
^[ascii.size].addAll(ascii) this.prSendMsg(this.deleteLabelMsg(identifier));
} }
addLabel{|id, label, action| clearMsg { ^this.prMakeMsg(\clear,id); }
this.prSendMsg(\addLabel, [id.asString, label.asString],action);
}
updateLabel{|id, label, action| clear { |action|
this.prSendMsg(\updateLabel, [id.asString, label.asString],action); actions[\clear] = [nil,action];
this.prSendMsg(this.clearMsg);
} }
getLabel{|id, action| printMsg { ^this.prMakeMsg(\print,id); }
this.prSendMsg(\getLabel, [id.asString], action,[string(FluidMessageResponse,_,_)]);
}
deleteLabel{|id, action|
this.prSendMsg(\deleteLabel, [id.asString],action);
}
clear {|action|
this.prSendMsg(\clear,[], action);
}
free {|action|
serverCaches.remove(server, id);
super.free;
}
*freeAll {|server|
serverCaches.do(server,{|x| x.free;});
}
print { |action| print { |action=(postResponse)|
action ?? {action = postit}; actions[\print] = [string(FluidMessageResponse,_,_),action];
this.prSendMsg(\print,[], action, [string(FluidMessageResponse,_,_)]); this.prSendMsg(this.printMsg);
} }
} }

@ -1,4 +1,4 @@
FluidMDS : FluidDataClient { FluidMDS : FluidModelObject {
classvar < manhattan = 0; classvar < manhattan = 0;
classvar < euclidean = 1; classvar < euclidean = 1;
classvar < sqeuclidean = 2; classvar < sqeuclidean = 2;
@ -7,17 +7,27 @@ FluidMDS : FluidDataClient {
classvar < kl = 5; classvar < kl = 5;
classvar < cosine = 5; classvar < cosine = 5;
var <>numDimensions, <>distanceMetric;
*new {|server,numDimensions = 2, distanceMetric = 1| *new {|server,numDimensions = 2, distanceMetric = 1|
^super.new1(server,[ ^super.new(server,[numDimensions, distanceMetric])
\numDimensions,numDimensions, .numDimensions_(numDimensions)
\distanceMetric, distanceMetric .distanceMetric_(distanceMetric);
])
} }
prGetParams{
^[this.numDimensions, this.distanceMetric];
}
fitTransformMsg{|sourceDataSet, destDataSet|
^this.prMakeMsg(\fitTransform,id, sourceDataSet.id, destDataSet.id);
}
fitTransform{|sourceDataSet, destDataSet, action| fitTransform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\fitTransform, actions[\fitTransform] = [nil,action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], action); this.fitTransformMsg(sourceDataSet,destDataSet).postln;
this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet));
} }
// not implemented // not implemented

@ -4,6 +4,7 @@ FluidMFCC : MultiOutUGen {
^this.multiNew('control', in.asAudioRateInput(this), numCoeffs, numBands, minFreq, maxFreq, maxNumCoeffs, windowSize, hopSize, fftSize, maxFFTSize); ^this.multiNew('control', in.asAudioRateInput(this), numCoeffs, numBands, minFreq, maxFreq, maxNumCoeffs, windowSize, hopSize, fftSize, maxFFTSize);
} }
init {arg ...theInputs; init {arg ...theInputs;
inputs = theInputs; inputs = theInputs;
^this.initOutputs(inputs.at(5),rate); ^this.initOutputs(inputs.at(5),rate);

@ -1,103 +1,151 @@
FluidMLPRegressor : FluidRTDataClient { FluidMLPRegressor : FluidRealTimeModel {
const <identity = 0; const <identity = 0;
const <sigmoid = 1; const <sigmoid = 1;
const <relu = 2; const <relu = 2;
const <tanh = 3; 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| *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; ^super.new(server, [hidden.size] ++ hidden ++ [activation, outputActivation, tapIn, tapOut, maxIter, learnRate, momentum, batchSize, validation])
.hidden_(hidden)
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i}; .activation_(activation)
.outputActivation_(outputActivation)
^super.new1(server, .tapIn_(tapIn)
[hiddenCtrlLabels,hidden].lace ++ .tapOut_(tapOut)
[ .maxIter_(maxIter)
\activation,activation, .learnRate_(learnRate)
\outputActivation, outputActivation, .momentum_(momentum)
\tapIn, tapIn, .batchSize_(batchSize)
\tapOut, tapOut, .validation_(validation);
\maxIter, maxIter, }
\learnRate,learnRate,
\momentum, momentum, prGetParams{
\batchsize,batchSize, ^[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]
\validation,validation,
])
} }
clearMsg{ ^this.prMakeMsg(\clear, id) }
clear{ |action| clear{ |action|
this.prSendMsg(\clear,action:action); actions[\clear] = [nil, action];
this.prSendMsg(this.clearMsg);
}
fitMsg{|sourceDataSet, targetDataSet|
^this.prMakeMsg(\fit,id,sourceDataSet.id, targetDataSet.id);
} }
fit{|sourceDataSet, targetDataSet, action| fit{|sourceDataSet, targetDataSet, action|
this.prSendMsg(\fit, actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
[sourceDataSet.asSymbol, targetDataSet.asSymbol], this.prSendMsg(this.fitMsg(sourceDataSet,targetDataSet));
action,numbers(FluidMessageResponse,_,1,_) }
);
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));
} }
predict{ |sourceDataSet, targetDataSet, action|
this.prSendMsg(\predict, predictPointMsg { |sourceBuffer, targetBuffer|
[sourceDataSet.asSymbol, targetDataSet.asSymbol], ^this.prMakeMsg(\predictPoint,id,
action); this.prEncodeBuffer(sourceBuffer),
this.prEncodeBuffer(targetBuffer),
["/b_query", targetBuffer.asUGenInput]);
} }
predictPoint { |sourceBuffer, targetBuffer, action| predictPoint { |sourceBuffer, targetBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer); actions[\predictPoint] = [nil,{action.value(targetBuffer)}];
targetBuffer = this.prEncodeBuffer(targetBuffer); this.predictPointMsg(sourceBuffer, targetBuffer).postln;
this.prSendMsg(\predictPoint, this.prSendMsg(this.predictPointMsg(sourceBuffer, targetBuffer));
[sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action,outputBuffers:[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 <identity = 0;
const <sigmoid = 1; const <sigmoid = 1;
const <relu = 2; const <relu = 2;
const <tanh = 3; const <tanh = 3;
*new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2| var <>hidden, <>activation, <> maxIter, <>learnRate, <> momentum, <>batchSize, <>validation;
var hiddenCtrlLabels;
hidden = [hidden.size]++hidden;
hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i}; *new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2|
^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);
}
^super.new1(server, prGetParams{
[hiddenCtrlLabels,hidden].lace ++ ^[ this.hidden.size] ++ this.hidden ++ [this.activation, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1];
[
\activation,activation,
\maxIter, maxIter,
\learnRate,learnRate,
\momentum, momentum,
\batchsize,batchSize,
\validation,validation,
])
} }
clearMsg{ ^this.prMakeMsg(\clear,id) }
clear{ |action| 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| fit{|sourceDataSet, targetLabelSet, action|
this.prSendMsg(\fit, actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action];
[sourceDataSet.asSymbol, targetLabelSet.asSymbol], this.prSendMsg(this.fitMsg(sourceDataSet,targetLabelSet));
action,numbers(FluidMessageResponse,_,1,_) }
);
predictMsg{|sourceDataSet, targetLabelSet|
^this.prMakeMsg(\predict,id,sourceDataSet.id, targetLabelSet.id);
} }
predict{ |sourceDataSet, targetLabelSet, action| predict{ |sourceDataSet, targetLabelSet, action|
this.prSendMsg(\predict, actions[\predict]=[nil,action];
[sourceDataSet.asSymbol, targetLabelSet.asSymbol], this.prSendMsg(this.predictMsg(sourceDataSet,targetLabelSet));
action); }
predictPointMsg { |sourceBuffer|
^this.prMakeMsg(\predictPoint,id,this.prEncodeBuffer(sourceBuffer))
} }
predictPoint { |sourceBuffer, action| predictPoint { |sourceBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer); actions[\predictPoint] = [string(FluidMessageResponse,_,_),action];
this.prSendMsg(\predictPoint, this.prSendMsg(this.predictPointMsg(sourceBuffer));
[sourceBuffer], action, string(FluidMessageResponse,_,_)); }
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,298 +0,0 @@
FluidProxyUgen : UGen {
var <>pluginname;
*kr { |pluginname...args|
^this.new1('control', pluginname,*args)
}
init { |pluginname...args|
this.pluginname = pluginname;
inputs = args;
pluginname
.asSymbol
.asClass
.superclasses
.indexOf(FluidRTDataClient) ??{inputs= inputs ++ [Done.none,0]};
rate = 'control';
}
name{
^pluginname.asString;
}
}
FluidManipulationClient {
classvar clock;
var <server;
var <synth,<>ugen;
var id;
var defName, def;
var onSynthFree, keepAlive;
var aliveThread;
var postit;
*initClass {
clock = TempoClock.new;
clock.permanent = true;
}
*prServerString{ |s|
var ascii = s.ascii;
^[ascii.size].addAll(ascii)
}
*newFromDesc { arg rate, numOutputs, inputs, specialIndex;
^FluidProxyUgen.newFromDesc(rate, numOutputs, inputs, specialIndex)
}
*new{ |server,objectID...args|
server = server ? Server.default;
if(server.serverRunning.not,{
(this.asString + " server not running").error; ^nil
});
^super.newCopyArgs(server ?? {Server.default});//.baseinit(objectID,*args)
}
makeDef { |defName,objectID,args|
var initialVals = [];
args!? { if(args.size > 0) {initialVals = args.unlace(2)[1].flatten}};
^SynthDef(defName,{
var ugen = FluidProxyUgen.kr(this.class.name, *(initialVals ++ objectID));
this.ugen = ugen;
ugen
});
}
updateSynthControls {}
baseinit { |objectID...args|
var makeFirstSynth,synthMsg,synthArgs;
id = UniqueID.next;
postit = {|x| x.postln;};
keepAlive = true;
defName = (this.class.name.asString ++ id).asSymbol;
def = this.makeDef(defName,objectID,args);
synth = Synth.basicNew(def.name, server);
synthMsg = synth.newMsg(RootNode(server),args);
def.doSend(server,synthMsg);
onSynthFree = {
synth = nil;
if(keepAlive){
synth = Synth(defName,target: RootNode(server));
synth.onFree{clock.sched(0,onSynthFree)};
this.updateSynthControls;
}
};
CmdPeriod.add({synth = nil});
synth.onFree{clock.sched(0,onSynthFree)};
}
free{
keepAlive = false;
if(server.serverRunning){server.sendMsg("/cmd","free"++this.class.name,id)};
synth.tryPerform(\free);
^nil
}
cols {|action|
action ?? {action = postit};
this.prSendMsg(\cols,[],action,[numbers(FluidMessageResponse,_,1,_)]);
}
read{|filename, action|
this.prSendMsg(\read,[filename.asString],action);
}
write{|filename, action|
this.prSendMsg(\write,[filename.asString],action);
}
size {|action|
action ?? {action = postit};
this.prSendMsg(\size,[],action,[numbers(FluidMessageResponse,_,1,_)]);
}
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
prSendMsg { |msg, args, action,parser,outputBuffers|
if(this.server.serverRunning.not,{(this.asString + " server not running").error; ^nil});
forkIfNeeded{
synth ?? {onSynthFree.value; server.sync};
OSCFunc(
{ |msg|
defer{
var result;
result = FluidMessageResponse.collectArgs(parser,msg.drop(3));
if(outputBuffers.notNil) {
forkIfNeeded {
outputBuffers.collectInPlace{ |b|
server.cachedBufferAt(b) !? {|x| x.updateInfo}
};
server.sync;
if(action.notNil){action.value(*(outputBuffers++result))}{action.value};
};
}
{if(action.notNil){action.value(result)}{action.value};}
}
},'/'++msg, server.addr, nil,[synth.nodeID]).oneShot;
server.listSendMsg(['/u_cmd', synth.nodeID, ugen.synthIndex, msg].addAll(args));
}
}
}
FluidDataClient : FluidManipulationClient {
var synthControls;
var <id;
var parameters;
var parameterDefaults;
*new {|server|
^this.new1(server,#[])
}
*new1{ |server, params|
var uid = UniqueID.next;
^super.new(server, uid, *params) !? { |inst| inst.init(uid, params) }
}
init { |uid, params|
id = uid;
params = params ?? {[]};
if(params.size > 0 and: synthControls.isNil) {synthControls = params.unlace[0]};
parameters = ().putPairs(params);
parameterDefaults = parameters.copy;
this.makePropertyMethods;
this.baseinit(uid,*params);
}
makePropertyMethods{
if (parameters.keys.size > 0) {
parameters.keys.do{|c,i|
this.addUniqueMethod(c,{ parameters.at(c) });
this.addUniqueMethod((c++\_).asSymbol,{|responder,x|
//if we have a default or initial value set, then fall back to
//this if val is nil. Otherwise, fallback even furter to -1 as
// a best guess
x = x ?? { parameterDefaults !? { parameterDefaults[c] } ?? {-1} };
parameters.put(c, x.asUGenInput);
synth !? { if(synth.isRunning){ synth.set(c,x); } };
responder
});
}
};
}
makeDef {|defName,uid,args|
var defControls = synthControls;
var ugenControls = [this.class.name] ++ synthControls ++ uid;
var f = (
"{ |dataClient|"
" SynthDef("++defName.asCompileString++", { |" ++ defControls.join(",") ++ "|"
" var ugen = FluidProxyUgen.kr(" ++ ugenControls.join(",") ++ ");"
" dataClient.ugen = ugen;"
" ugen"
" })"
"}"
);
var res = f.interpret.value(this);
^res
}
updateSynthControls{
synth !? { synth.set(*parameters.asKeyValuePairs); };
}
}
FluidRTDataClient : FluidDataClient
{
*new1{|server, params|
params = params ?? {[]};
^super.new1(server,params)
}
init { |uid, params|
id = uid;
params = params ?? {[]};
if(params.size > 0) {synthControls = params.unlace[0]}{synthControls=[]};
params = params ++ [\inBus,Bus.control(server),\outBus,Bus.control(server),\inBuffer,-1,\outBuffer,-1];
parameters = ().putPairs(params);
parameterDefaults = parameters.copy;
this.makePropertyMethods;
this.baseinit(uid,*params);
}
makeDef {|defName,uid,args|
var defControls = [\inBus, \outBus] ++ synthControls ++ [\inBuffer,\outBuffer];
var ugenControls = [this.class.name,"T2A.ar(In.kr(inBus))"] ++ synthControls ++ [\inBuffer,\outBuffer,uid];
var f = (
"{ |dataClient|"
" SynthDef("++defName.asCompileString++", { |" ++ defControls.join(",") ++ "|"
" var ugen = FluidProxyUgen.kr(" ++ ugenControls.join(",") ++ ");"
" dataClient.ugen = ugen;"
" Out.kr(outBus,ugen);"
" })"
"}"
);
var res = f.interpret.value(this);
^res
}
}
FluidServerCache {
var cache;
*new{ ^super.new.init }
init{
cache = IdentityDictionary.new;
}
do { |server, func|
cache[server]!?{cache[server].do{|x|func.value(x)}}
}
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.removeAt(server) };
}
}

@ -1,4 +1,4 @@
+ FluidManipulationClient { + FluidDataObject {
tmpJSONFilename{ tmpJSONFilename{
^Platform.defaultTempDir++"tmp_fluid_data_"++ ^Platform.defaultTempDir++"tmp_fluid_data_"++
Date.localtime.stamp++"_"++UniqueID.next++".json"; Date.localtime.stamp++"_"++UniqueID.next++".json";
@ -6,7 +6,7 @@
dump {|action| dump {|action|
var filename = this.tmpJSONFilename; var filename = this.tmpJSONFilename;
action ?? {action = postit}; action ?? {action = postResponse};
this.write(filename, { this.write(filename, {
action.value(this.parseJSON(File.readAllString(filename))); action.value(this.parseJSON(File.readAllString(filename)));
File.delete(filename); File.delete(filename);

@ -1,31 +1,68 @@
FluidNormalize : FluidRTDataClient { FluidNormalize : FluidRealTimeModel {
var <>min, <>max, <>invert;
*new {|server, min = 0, max = 1, invert = 0| *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| 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| transform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\transform, actions[\transform] = [nil,action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], action this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet));
); }
fitTransformMsg{|sourceDataSet, destDataSet|
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
} }
fitTransform{|sourceDataSet, destDataSet, action| fitTransform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\fitTransform, actions[\fitTransform] = [nil,action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], 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| transformPoint{|sourceBuffer, destBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer); actions[\transformPoint] = [nil,{action.value(destBuffer)}];
destBuffer = this.prEncodeBuffer(destBuffer); this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer));
this.prSendMsg(\transformPoint, }
[sourceBuffer, destBuffer], action,
outputBuffers:[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{
var <>numDimensions;
*new {|server, numDimensions = 2| *new {|server, numDimensions = 2|
^super.new1(server,[\numDimensions,numDimensions]); ^super.new(server,[numDimensions]).numDimensions_(numDimensions);
}
prGetParams{
^[numDimensions,-1,-1];
}
fitMsg{|dataSet|
^this.prMakeMsg(\fit,id, dataSet.id);
} }
fit{|dataSet, action| 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| 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| 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| transformPoint{|sourceBuffer, destBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer); actions[\transformPoint] = [nil,{action.value(destBuffer)}];
destBuffer = this.prEncodeBuffer(destBuffer); this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
this.prSendMsg(\transformPoint,[sourceBuffer, destBuffer], action, outputBuffers:[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 { FluidStandardize : FluidRealTimeModel {
var <>invert;
*new {|server, invert = 0| *new {|server, invert = 0|
^super.new1(server,[\invert, invert]); ^super.new(server,[invert]).invert_(invert);
}
prGetParams{
^[this.invert, -1, 1];
}
fitMsg{|dataSet|
^this.prMakeMsg(\fit,id,dataSet.id);
} }
fit{|dataSet, action| 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| transform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\transform, actions[\transform] = [nil,action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], action this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
); }
fitTransformMsg{|sourceDataSet, destDataSet|
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
} }
fitTransform{|sourceDataSet, destDataSet, action| fitTransform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\fitTransform, actions[\fitTransform] = [nil,action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], 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| transformPoint{|sourceBuffer, destBuffer, action|
sourceBuffer = this.prEncodeBuffer(sourceBuffer); actions[\transformPoint] = [nil, {action.value(destBuffer)}];
destBuffer = this.prEncodeBuffer(destBuffer); this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer));
this.prSendMsg(\transformPoint, }
[sourceBuffer, destBuffer], action, outputBuffers:[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));
} }
} }

@ -1,20 +1,35 @@
FluidUMAP : FluidDataClient { FluidUMAP : FluidModelObject {
var <>numDimensions, <>numNeighbours, <>minDist, <>iterations, <>learnRate, <>batchSize;
*new {|server,numDimensions = 2, numNeighbours = 15, minDist = 0.1, iterations = 200, learnRate = 0.1, batchSize = 50| *new {|server,numDimensions = 2, numNeighbours = 15, minDist = 0.1, iterations = 200, learnRate = 0.1, batchSize = 50|
^super.new1(server,[ ^super.new(server,[numDimensions, numNeighbours, minDist, iterations, learnRate, batchSize])
\numDimensions,numDimensions, .numDimensions_(numDimensions)
\numNeighbours, numNeighbours, .numNeighbours_(numNeighbours)
\minDist, minDist, .minDist_(minDist)
\iterations, iterations, .iterations_(iterations)
\learnRate, learnRate, .learnRate_(learnRate)
\batchSize, batchSize .batchSize_(batchSize);
]) }
prGetParams{
^[
this.numDimensions,
this.numNeighbours,
this.minDist,
this.iterations,
this.learnRate,
this.batchSize
]
} }
fitTransformMsg{|sourceDataSet, destDataSet|
^this.prMakeMsg(\fitTransform, id, sourceDataSet.id, destDataSet.id)
}
fitTransform{|sourceDataSet, destDataSet, action| fitTransform{|sourceDataSet, destDataSet, action|
this.prSendMsg(\fitTransform, actions[\fitTransform] = [nil, action];
[sourceDataSet.asSymbol, destDataSet.asSymbol], action); this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet));
} }
// not implemented // not implemented

Loading…
Cancel
Save