diff --git a/release-packaging/Classes/FluidBufAmpGate.sc b/release-packaging/Classes/FluidBufAmpGate.sc index 29faef9..0063f3c 100644 --- a/release-packaging/Classes/FluidBufAmpGate.sc +++ b/release-packaging/Classes/FluidBufAmpGate.sc @@ -1,36 +1,43 @@ -FluidBufAmpGate : UGen { +FluidBufAmpGate : FluidBufProcessor { - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking| - var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead)); + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0| + + var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead)); - source = source.asUGenInput; - indices = indices.asUGenInput; + source = source.asUGenInput; + indices = indices.asUGenInput; + + ^FluidProxyUgen.kr(\FluidBufAmpGateTrigger,-1, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq,maxSize, trig, blocking); + } - source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; - indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw}; + *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 | - ^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| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, trig, blocking); - } + var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead)); - *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 | + source = source ? -1; + indices = indices ? -1; - ^FluidNRTProcess.new( - server, this, action, [indices] - ).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 | - ^FluidNRTProcess.new( - server, this, action, [indices], blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq - ); - } + + var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead)); + + source = source ? -1; + indices = indices ? -1; + + ^this.new( + server, nil, [indices] + ).processList( + [source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 1],freeWhenDone,action + ); + } + } diff --git a/release-packaging/Classes/FluidBufAmpSlice.sc b/release-packaging/Classes/FluidBufAmpSlice.sc index dd2e46c..0e20f07 100644 --- a/release-packaging/Classes/FluidBufAmpSlice.sc +++ b/release-packaging/Classes/FluidBufAmpSlice.sc @@ -1,35 +1,39 @@ -FluidBufAmpSlice : UGen { +FluidBufAmpSlice : FluidBufProcessor { - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking| + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking = 0| + + source = source.asUGenInput; + indices = indices.asUGenInput; + + source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufAmpSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking); + } - source = source.asUGenInput; - indices = indices.asUGenInput; + *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 | - source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; - indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw}; + source = source.asUGenInput; + indices = indices.asUGenInput; - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking); - } + source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw}; - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq, trig, blocking); + ^this.new(server, nil, [indices]).processList( + [source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,0],freeWhenDone, action + ); } - *process { |server,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, fastRampUp = 1, fastRampDown = 1, slowRampUp = 100, slowRampDown = 100, onThreshold = -144, offThreshold = -144, floor = -144, minSliceLength = 2, highPassFreq = 85, action | + *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 | - ^FluidNRTProcess.new( - server, this, action, [indices] - ).process( - source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq - ); - } + source = source.asUGenInput; + indices = indices.asUGenInput; - *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| + source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw}; - ^FluidNRTProcess.new( - server, this, action, [indices], blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq + ^this.new(server, nil, [indices]).processList( + [source, startFrame, numFrames, startChan, numChans, indices, fastRampUp, fastRampDown, slowRampUp, slowRampDown, onThreshold, offThreshold, floor, minSliceLength, highPassFreq,1],freeWhenDone, action ); } } diff --git a/release-packaging/Classes/FluidBufAudioTransport.sc b/release-packaging/Classes/FluidBufAudioTransport.sc index 783ef75..f7021c4 100644 --- a/release-packaging/Classes/FluidBufAudioTransport.sc +++ b/release-packaging/Classes/FluidBufAudioTransport.sc @@ -1,40 +1,58 @@ -FluidBufAudioTransport : UGen{ - *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| +FluidBufAudioTransport : FluidBufProcessor { - 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; + *objectClassName{ + ^\FluidBufAudioTransp + } - destination.isNil.if {"FluidAudioTransport: Invalid destination buffer".throw}; - destination = destination.asUGenInput; + *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| - //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) + 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; - } - *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); + ^FluidProxyUgen.kr(\FluidBufAudioTransportTrigger,-1, source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame1, numFrames1, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize, maxFFTSize, 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, action| - ^FluidNRTProcess.new( - server, this, action, [destination] - ).process( - source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize + *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; + + ^this.new( + server, nil, [destination] + ).processList( + [source1, startFrame1, numFrames1, startChan1, numChans1, source2, startFrame2, numFrames2, startChan2, numChans2, destination, interpolation, bandwidth, windowSize, hopSize, fftSize,maxFFTSize,0], freeWhenDone, 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, action| - ^FluidNRTProcess.new( - server, this, action, [destination],blocking:1 - ).process( - 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, 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; + + ^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 ) } } - diff --git a/release-packaging/Classes/FluidBufCompose.sc b/release-packaging/Classes/FluidBufCompose.sc index a681ceb..a86c0d8 100644 --- a/release-packaging/Classes/FluidBufCompose.sc +++ b/release-packaging/Classes/FluidBufCompose.sc @@ -1,33 +1,38 @@ -FluidBufCompose : UGen { - - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, trig = 1, blocking| - - source = source.asUGenInput; - destination = destination.asUGenInput; - - source.isNil.if {"FluidBufCompose: Invalid source buffer".throw}; - destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw}; - - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, trig, blocking); - } +FluidBufCompose : FluidBufProcessor { *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); + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufCompose: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1, 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, action| - ^FluidNRTProcess.new( - server, this, action, [destination], blocking:1 - ).process( - source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain - ); + *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; + source.isNil.if {"FluidBufCompose: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw}; + + ^this.new( server, nil, [destination]).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);//NB always blocking } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, action| - ^process( - source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain - ); + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, freeWhenDone, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufCompose: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination] + ).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action); } } diff --git a/release-packaging/Classes/FluidBufFlatten.sc b/release-packaging/Classes/FluidBufFlatten.sc index f08833b..e664290 100644 --- a/release-packaging/Classes/FluidBufFlatten.sc +++ b/release-packaging/Classes/FluidBufFlatten.sc @@ -1,31 +1,46 @@ -FluidBufFlatten : UGen { +FluidBufFlatten : FluidBufProcessor { - *new1 { |rate, source, destination, axis = 1, trig = 1, blocking| - source = source.asUGenInput; - destination = destination.asUGenInput; + *kr { |source, destination, axis = 1, trig = 1, blocking = 1| + + source = source.asUGenInput; + destination = destination.asUGenInput; - source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw}; - destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw}; - ^super.new1(rate, source, destination, axis, trig, blocking); + source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, destination, axis, trig, blocking); } - *kr { |source, destination, axis = 1, trig = 1, blocking = 1| - ^this.new1('control', source, destination, axis, trig, blocking); - } + *process { |server, source, destination, axis = 1, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; - *process { |server, source, destination, axis = 1, action| - ^FluidNRTProcess.new( - server, this, action, [destination], blocking:1 - ).process( - 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| - ^process( - source, destination, axis - ); - } + *processBlocking { |server, source, destination, axis = 1, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination], + ).processList( + [source, destination, axis,1],freeWhenDone,action + ); + + } } diff --git a/release-packaging/Classes/FluidBufHPSS.sc b/release-packaging/Classes/FluidBufHPSS.sc index 33ae626..b7b0a9a 100644 --- a/release-packaging/Classes/FluidBufHPSS.sc +++ b/release-packaging/Classes/FluidBufHPSS.sc @@ -1,45 +1,51 @@ -FluidBufHPSS : UGen { +FluidBufHPSS : FluidBufProcessor { - *new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking| + *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.asUGenInput; - percussive = percussive.asUGenInput; - residual = residual.asUGenInput; - source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw}; + harmonic = harmonic ? -1; + percussive = percussive ? -1; + residual = residual ? -1; + source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw}; - //NB For wrapped versions of NRT classes, we set the params for maxima to - //whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value) - - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize, trig, blocking); + ^FluidProxyUgen.kr(\FluidBufHPSSTrigger, -1, source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize, trig, blocking + ); } - *kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| + *process {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone=true, action| - ^this.multiNew( - 'control', source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, trig, blocking - ); - } + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + + 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( - server, this, action, [harmonic, percussive, residual].select{|x| x!= -1} - ).process( - source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize + ^this.new( + server, nil, [harmonic, percussive, residual].select{|x| x!= -1} + ).processList( + [source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize, harmFilterSize, percFilterSize,0], freeWhenDone,action ); } - *processBlocking {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| + *processBlocking {|server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic = -1, percussive = -1, residual = -1, harmFilterSize = 17, percFilterSize = 31, maskingMode = 0, harmThreshFreq1 = 0.1, harmThreshAmp1 = 0, harmThreshFreq2 = 0.5, harmThreshAmp2 = 0, percThreshFreq1 = 0.1, percThreshAmp1 = 0, percThreshFreq2 = 0.5, percThreshAmp2 = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone=true, action| - ^FluidNRTProcess.new( - server, this, action, [harmonic, percussive, residual].select{|x| x!= -1}, blocking:1 - ).process( - source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize - ); + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - } + harmonic = harmonic ? -1; + percussive = percussive ? -1; + residual = residual ? -1; + source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw}; + + + ^this.new( + server, nil, [harmonic, percussive, residual].select{|x| x!= -1} + ).processList( + [source, startFrame, numFrames, startChan, numChans, harmonic, percussive, residual, harmFilterSize, percFilterSize, maskingMode, harmThreshFreq1, harmThreshAmp1, harmThreshFreq2, harmThreshAmp2, percThreshFreq1, percThreshAmp1, percThreshFreq2, percThreshAmp2, windowSize, hopSize, fftSize, maxFFTSize,harmFilterSize, percFilterSize,1], freeWhenDone,action + ); + + } } diff --git a/release-packaging/Classes/FluidBufLoudness.sc b/release-packaging/Classes/FluidBufLoudness.sc index 31675e8..c6c5568 100644 --- a/release-packaging/Classes/FluidBufLoudness.sc +++ b/release-packaging/Classes/FluidBufLoudness.sc @@ -1,6 +1,6 @@ -FluidBufLoudness : UGen{ - *new1 { |rate,source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, trig = 1, blocking = 0| - +FluidBufLoudness : FluidBufProcessor{ + *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; source = source.asUGenInput; @@ -8,27 +8,41 @@ FluidBufLoudness : UGen{ source.isNil.if {"FluidBufPitch: Invalid source 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| - ^this.multiNew('control', source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, trig, blocking ); - } + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, freeWhenDone = true, action| + + var maxwindowSize = windowSize.nextPowerOfTwo; + + source = source.asUGenInput; + features = features.asUGenInput; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action| - ^FluidNRTProcess.new( - server, this, action, [features] - ).process( - source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize + 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,0],freeWhenDone,action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, action| - ^FluidNRTProcess.new( - server, this, action, [features], blocking: 1 - ).process( - 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, freeWhenDone = true, action| + + 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}; + + ^this.new( + server, nil, [features] + ).processList( + [source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,1],freeWhenDone,action ); } } diff --git a/release-packaging/Classes/FluidBufMFCC.sc b/release-packaging/Classes/FluidBufMFCC.sc index 845c8a2..f7bd1c3 100644 --- a/release-packaging/Classes/FluidBufMFCC.sc +++ b/release-packaging/Classes/FluidBufMFCC.sc @@ -1,37 +1,45 @@ -FluidBufMFCC : UGen{ - *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| - +FluidBufMFCC : FluidBufProcessor{ + *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}; source = source.asUGenInput; features = features.asUGenInput; source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw}; features.isNil.if {"FluidBufMFCC: 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 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); + + ^FluidProxyUgen.kr(\FluidBufMFCCTrigger, -1, 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| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize, trig, blocking); - } + *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 | + + 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 | - ^FluidNRTProcess.new( - server, this, action, [features] - ).process( - source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize + 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,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 | - ^FluidNRTProcess.new( - server, this, action, [features],blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, windowSize, hopSize, fftSize + *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 | + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + source = source.asUGenInput; + 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 ); } } diff --git a/release-packaging/Classes/FluidBufMelBands.sc b/release-packaging/Classes/FluidBufMelBands.sc index 28ee4b4..d238e61 100644 --- a/release-packaging/Classes/FluidBufMelBands.sc +++ b/release-packaging/Classes/FluidBufMelBands.sc @@ -1,38 +1,50 @@ -FluidBufMelBands : UGen { - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| +FluidBufMelBands : FluidBufProcessor { - var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - source = source.asUGenInput; - features = features.asUGenInput; + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw}; - features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw}; + source = source.asUGenInput; + features = features.asUGenInput; - //NB For wrapped versions of NRT classes, we set the params for maxima to - //whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value) - // same for maxNumBands which is passed numBands + source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw}; + features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw}; - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); - } - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize, trig, blocking); + ^FluidProxyUgen.kr(\FluidBufMelBandsTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize, trig, blocking); } - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features] - ).process( - source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, normalize, windowSize, hopSize, fftSize + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + + source = source.asUGenInput; + features = features.asUGenInput; + + source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw}; + features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw}; + + ^this.new( + server, nil, [features] + ).processList( + [source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features], blocking:1 - ).process( - source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, normalize, windowSize, hopSize, fftSize + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + + source = source.asUGenInput; + features = features.asUGenInput; + + source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw}; + features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw}; + + ^this.new( + server, nil, [features] + ).processList( + [source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, normalize, windowSize, hopSize, fftSize,maxFFTSize,1],freeWhenDone,action ); + } } -} \ No newline at end of file diff --git a/release-packaging/Classes/FluidBufNMF.sc b/release-packaging/Classes/FluidBufNMF.sc index 74ee122..c21873b 100644 --- a/release-packaging/Classes/FluidBufNMF.sc +++ b/release-packaging/Classes/FluidBufNMF.sc @@ -1,47 +1,36 @@ -FluidBufNMF : UGen { - - *new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0| - - source = source.asUGenInput; - resynth = resynth.asUGenInput; - bases = bases.asUGenInput; - activations = activations.asUGenInput; - - source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; +FluidBufNMF : FluidBufProcessor //: UGen { +{ + *kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0| + source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; resynth = resynth ? -1; bases = bases ? -1; - activations = activations ? -1; - - ^super.new1(rate,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking); - - } - - *kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, trig = 1, blocking = 0| - ^this.new1(\control,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking); - + activations = activations ? -1; + + ^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, trig, blocking); } + + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,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}; - - ^FluidNRTProcess.new( - server, this, action, [resynth, bases, activations].select{|x| x!= -1} - ).process( - source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed - ); + source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; + resynth = resynth ? -1; + bases = bases ? -1; + activations = activations ? -1; + + ^this.new( + server,nil,[resynth, bases, activations].select{|x| x!= -1} + ).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize,0],freeWhenDone,action); } + + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1,freeWhenDone = true, action| - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action| - - source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; - - ^FluidNRTProcess.new( - server, this, action, [resynth, bases, activations].select{|x| x!= -1},blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed - ); + source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; + resynth = resynth ? -1; + bases = bases ? -1; + activations = activations ? -1; + + ^this.new( + server,nil,[resynth, bases, activations].select{|x| x!= -1} + ).processList([source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, 1],freeWhenDone,action); } } diff --git a/release-packaging/Classes/FluidBufNMFCross.sc b/release-packaging/Classes/FluidBufNMFCross.sc index 354e66f..22499b5 100644 --- a/release-packaging/Classes/FluidBufNMFCross.sc +++ b/release-packaging/Classes/FluidBufNMFCross.sc @@ -1,34 +1,48 @@ -FluidBufNMFCross : UGen{ - - *new1 { |rate, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - +FluidBufNMFCross : FluidBufProcessor { + + *kr { |source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| + source = source.asUGenInput; - target = target.asUGenInput; - output = output.asUGenInput; - source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw}; - target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw}; + target = target.asUGenInput; + output = output.asUGenInput; + source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw}; + target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw}; output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw}; - - ^super.new1(rate, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking); + + ^FluidProxyUgen.kr(\FluidBufNMFCrossTrigger, -1, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking); } - *kr { |source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - ^this.multiNew(\control, source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize, trig, blocking); - } + *process { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + source = source.asUGenInput; + target = target.asUGenInput; + output = output.asUGenInput; + source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw}; + target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw}; + output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw}; - *process { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [output].select{|x| x!= -1} - ).process( - source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize + + ^this.new( + server, nil, [output] + ).processList( + [source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize,0],freeWhenDone, action ); } - *processBlocking { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [output].select{|x| x!= -1}, blocking: 1 - ).process( - source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize + *processBlocking { |server, source, target, output , timeSparsity = 10, polyphony = 7, iterations = 50, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + source = source.asUGenInput; + target = target.asUGenInput; + output = output.asUGenInput; + source.isNil.if {"FluidBufNMFCross: Invalid source buffer".throw}; + target.isNil.if {"FluidBufNMFCross: Invalid target buffer".throw}; + output.isNil.if {"FluidBufNMFCross: Invalid output buffer".throw}; + + + ^this.new( + server, nil, [output] + ).processList( + [source, target, output, timeSparsity, polyphony, iterations, windowSize, hopSize, fftSize,1],freeWhenDone, action ); } } diff --git a/release-packaging/Classes/FluidBufNNDSVD.sc b/release-packaging/Classes/FluidBufNNDSVD.sc index 128c6fa..05d76ea 100644 --- a/release-packaging/Classes/FluidBufNNDSVD.sc +++ b/release-packaging/Classes/FluidBufNNDSVD.sc @@ -1,35 +1,47 @@ -FluidBufNNDSVD : UGen{ - *new1 { |rate, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking=0| - - 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; - - ^super.new1(rate, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking) - - } +FluidBufNNDSVD : FluidBufProcessor{ *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); + + source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw}; + bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + source = source.asUGenInput; + bases = bases.asUGenInput; + activations = activations.asUGenInput; + + ^FluidProxyUgen.kr1(\FluidBufNNDSVDTrigger, -1, source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize, trig, blocking); } - *process { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [bases] - ).process( - source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize + *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; + + ^this.new( + server, nil, [bases] + ).processList( + [source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize,0],freeWhenDone, action ) } - *processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [bases],blocking:1 - ).process( - source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize + *processBlocking { |server, source, bases, activations, minComponents = 1, maxComponents = 200, coverage = 0.5, method = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + source.isNil.if {"FluidBufNNDSVD: Invalid source buffer".throw}; + bases.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + activations.isNil.if {"FluidBufNNDSVD: Invalid bases buffer".throw}; + source = source.asUGenInput; + bases = bases.asUGenInput; + activations = activations.asUGenInput; + + ^this.new( + server, nil, [bases] + ).processList( + [source, bases, activations, minComponents, maxComponents, coverage, method, windowSize, hopSize, fftSize,1],freeWhenDone, action ) } } diff --git a/release-packaging/Classes/FluidBufNoveltySlice.sc b/release-packaging/Classes/FluidBufNoveltySlice.sc index 0ee8bcf..bae3651 100644 --- a/release-packaging/Classes/FluidBufNoveltySlice.sc +++ b/release-packaging/Classes/FluidBufNoveltySlice.sc @@ -1,7 +1,8 @@ -FluidBufNoveltySlice : UGen { - *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 | +FluidBufNoveltySlice : FluidBufProcessor { - var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + *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}; source = source.asUGenInput; indices = indices.asUGenInput; @@ -9,29 +10,41 @@ FluidBufNoveltySlice : UGen { source.isNil.if {"FluidBufNoveltySlice: Invalid source 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 | + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize, trig, blocking); + source = source.asUGenInput; + indices = indices.asUGenInput; - } - - *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 | - ^FluidNRTProcess.new( - server, this, action, [indices] - ).process( - source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, minSliceLength, windowSize, hopSize, fftSize + 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,0],freeWhenDone,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, action | - ^FluidNRTProcess.new( - server, this, action, [indices], blocking:1 - ).process( - 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, freeWhenDone = true, action | + + 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}; + + ^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 ); } } diff --git a/release-packaging/Classes/FluidBufOnsetSlice.sc b/release-packaging/Classes/FluidBufOnsetSlice.sc index 95568c0..77f6f38 100644 --- a/release-packaging/Classes/FluidBufOnsetSlice.sc +++ b/release-packaging/Classes/FluidBufOnsetSlice.sc @@ -1,37 +1,48 @@ -FluidBufOnsetSlice : UGen { - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| +FluidBufOnsetSlice : FluidBufProcessor { + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + source = source.asUGenInput; + indices = indices.asUGenInput; - source = source.asUGenInput; - indices = indices.asUGenInput; + source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufOnsetSliceTrigger, -1, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); + } - source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw}; - indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw}; + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - //NB For wrapped versions of NRT classes, we set the params for maxima to - //whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value) + source = source.asUGenInput; + indices = indices.asUGenInput; - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); + source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw}; + + ^this.new( + server, nil, [indices] + ).processList( + [source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize,maxFFTSize,0],freeWhenDone,action + ); } - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, trig, blocking); - } + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [indices] - ).process( - source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize - ); - } + source = source.asUGenInput; + indices = indices.asUGenInput; - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, metric = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [indices], blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, indices, metric, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize + 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 ); } } diff --git a/release-packaging/Classes/FluidBufPitch.sc b/release-packaging/Classes/FluidBufPitch.sc index a53318a..3092496 100644 --- a/release-packaging/Classes/FluidBufPitch.sc +++ b/release-packaging/Classes/FluidBufPitch.sc @@ -1,39 +1,50 @@ -FluidBufPitch : UGen{ +FluidBufPitch : FluidBufProcessor{ + + *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}; - *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| + source = source.asUGenInput; + features = features.asUGenInput; - var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - - source = source.asUGenInput; - features = features.asUGenInput; - - source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; - features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; - - //NB For wrapped versions of NRT classes, we set the params for maxima to - //whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value) - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); + source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; + features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufPitchTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); } - *kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, trig, blocking); + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; - } + source = source.asUGenInput; + features = features.asUGenInput; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features] - ).process( - source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize + source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; + features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; + + ^this.new( + server, nil, [features] + ).processList( + [source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, 0], freeWhenDone, action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features], blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + + source = source.asUGenInput; + features = features.asUGenInput; + + source.isNil.if {"FluidBufPitch: Invalid source buffer".throw}; + features.isNil.if {"FluidBufPitch: Invalid features buffer".throw}; + + ^this.new( + server, nil, [features] + ).processList( + [source, startFrame, numFrames, startChan, numChans, features, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize, 1], freeWhenDone, action ); } } diff --git a/release-packaging/Classes/FluidBufScale.sc b/release-packaging/Classes/FluidBufScale.sc index c56ee35..a36425d 100644 --- a/release-packaging/Classes/FluidBufScale.sc +++ b/release-packaging/Classes/FluidBufScale.sc @@ -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| - - source = source.asUGenInput; - destination = destination.asUGenInput; + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, trig = 1, blocking = 1| + + source = source.asUGenInput; + destination = destination.asUGenInput; - source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; - destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw}; - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, trig, blocking); + source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufScaleTrigger, -1, 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| - ^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, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action| - ^FluidNRTProcess.new( - server, this, action, [destination], blocking:1 - ).process( - source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh + source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination] + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 0], freeWhenDone, action ); - } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, action| - ^process( - source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh - ); + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, inputLow = 0, inputHigh = 1, outputLow = 0, outputHigh = 1, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufScale: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufScale: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination] + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, inputLow, inputHigh, outputLow, outputHigh, 1], freeWhenDone, action + ); } } diff --git a/release-packaging/Classes/FluidBufSines.sc b/release-packaging/Classes/FluidBufSines.sc index 4b6d938..c4056db 100644 --- a/release-packaging/Classes/FluidBufSines.sc +++ b/release-packaging/Classes/FluidBufSines.sc @@ -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; - sines = sines.asUGenInput; - residual = residual.asUGenInput; + source = source.asUGenInput; + sines = sines !? {sines.asUGenInput} ?? {-1}; + 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 - //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); + ^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); } - *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| - ^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, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; + + source = source.asUGenInput; + sines = sines !? {sines.asUGenInput} ?? {-1}; + residual = residual !? {residual.asUGenInput} ?? {-1}; + + source.isNil.if {"FluidBufSines: Invalid source buffer".throw}; - *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| - ^FluidNRTProcess.new( - server, this, action, [sines, residual].select{|x| x!= -1} - ).process( - source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize + ^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| - ^FluidNRTProcess.new( - server, this, action, [sines, residual].select{|x| x!= -1}, blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, detectionThreshold,birthLowThreshold, birthHighThreshold, minTrackLen, trackingMethod, trackMagRange, trackFreqRange, trackProb, windowSize, hopSize, fftSize + *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| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {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 ); } diff --git a/release-packaging/Classes/FluidBufSpectralShape.sc b/release-packaging/Classes/FluidBufSpectralShape.sc index 4c2cbf6..bcaf3f5 100644 --- a/release-packaging/Classes/FluidBufSpectralShape.sc +++ b/release-packaging/Classes/FluidBufSpectralShape.sc @@ -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}; @@ -10,33 +14,41 @@ FluidBufSpectralShape : UGen { source.isNil.if {"FluidBufSpectralShape: Invalid source buffer".throw}; features.isNil.if {"FluidBufSpectralShape: Invalid features buffer".throw}; - //NB For wrapped versions of NRT classes, we set the params for maxima to - //whatever has been passed in language-side (e.g maxFFTSize still exists as a parameter for the server plugin, but makes less sense here: it just needs to be set to a legal value) - - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking); + ^FluidProxyUgen.kr(\FluidBufSpectralShapeTrigger, -1, 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| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, features, 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, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features] - ).process( - source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize + 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, 0], freeWhenDone, action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, action| - ^FluidNRTProcess.new( - server, this, action, [features], blocking: 1 - ).process( - 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, freeWhenDone = true, action| + + var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {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 ); } - } diff --git a/release-packaging/Classes/FluidBufStats.sc b/release-packaging/Classes/FluidBufStats.sc index 75240a1..e29f5d4 100644 --- a/release-packaging/Classes/FluidBufStats.sc +++ b/release-packaging/Classes/FluidBufStats.sc @@ -1,36 +1,51 @@ -FluidBufStats : UGen{ +FluidBufStats : FluidBufProcessor { - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0| - - source = source.asUGenInput; - stats = stats.asUGenInput; + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0| + + source = source.asUGenInput; + stats = stats.asUGenInput; weights = weights.asUGenInput; - source.isNil.if {"FluidBufStats: Invalid source buffer".throw}; - stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw}; - weights = weights ? -1; - - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking); + source.isNil.if {"FluidBufStats: Invalid source buffer".throw}; + stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw}; + weights = weights ? -1; + + ^FluidProxyUgen.kr(\FluidBufStatsTrigger, -1, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking); } - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high, outliersCutoff, weights, trig, blocking); - } + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, freeWhenDone = true, action| + + source = source.asUGenInput; + stats = stats.asUGenInput; + weights = weights.asUGenInput; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, action| - ^FluidNRTProcess.new( - server, this, action, [stats] - ).process( - source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights + 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, 0], freeWhenDone, action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, action| - ^FluidNRTProcess.new( - server, this, action, [stats], blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, outliersCutoff = -1, weights, freeWhenDone = true, action| + + source = source.asUGenInput; + stats = stats.asUGenInput; + weights = weights.asUGenInput; + + source.isNil.if {"FluidBufStats: Invalid source buffer".throw}; + stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw}; + weights = weights ? -1; + + ^this.new( + server, nil, [stats] + ).processList( + [source, startFrame, numFrames, startChan, numChans, stats,numDerivs, low, middle, high, outliersCutoff, weights, 1], freeWhenDone, action ); } + } diff --git a/release-packaging/Classes/FluidBufThreadDemo.sc b/release-packaging/Classes/FluidBufThreadDemo.sc index 17795ea..03f5c3d 100644 --- a/release-packaging/Classes/FluidBufThreadDemo.sc +++ b/release-packaging/Classes/FluidBufThreadDemo.sc @@ -1,29 +1,33 @@ -FluidBufThreadDemo : UGen{ +FluidBufThreadDemo : FluidBufProcessor{ - *new1 {|rate, result, time, trig = 1, blocking = 0 | - result = result.asUGenInput; - result.isNil.if {this.class.name+": Invalid output buffer".throw}; - ^super.new1(rate, result, time, trig, blocking); - } + *kr {|result, time, trig = 1, blocking = 0| + result = result.asUGenInput; + result.isNil.if {this.class.name+": Invalid output buffer".throw}; - *kr {|result, time, trig = 1, blocking = 0| - ^this.new1(\control, result, time, trig, blocking); + ^FluidProxyUgen.kr(\FluidBufThreadDemoTrigger, -1, result, time, trig, blocking); } - *process { |server, result, time = 1000, action| - ^FluidNRTProcess.new( - server, this, action, [result] - ).process( - result, time + *process { |server, result, time = 1000, freeWhenDone = true, action| + + + result ?? {this.class.name+": Invalid output buffer".throw}; + + ^this.new( + server, nil, [result] + ).processList( + [result.asUGenInput, time, 0], freeWhenDone, action ); } - *processBlocking { |server, result, time = 1000, action| - ^FluidNRTProcess.new( - server, this, action, [result], blocking: 1 - ).process( - result, time + *processBlocking { |server, result, time = 1000, freeWhenDone = true, action| + + result ?? {this.class.name+": Invalid output buffer".throw}; + + ^this.new( + server, nil, [result] + ).processList( + [result.asUGenInput, time, 1], freeWhenDone, action ); } } diff --git a/release-packaging/Classes/FluidBufThresh.sc b/release-packaging/Classes/FluidBufThresh.sc index ca4c942..47ecaff 100644 --- a/release-packaging/Classes/FluidBufThresh.sc +++ b/release-packaging/Classes/FluidBufThresh.sc @@ -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| - - source = source.asUGenInput; - destination = destination.asUGenInput; + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, trig = 1, blocking = 1| + + source = source.asUGenInput; + destination = destination.asUGenInput; - source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; - destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, destination, threshold, trig, blocking); + source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; + + ^FluidProxyUgen.kr(\FluidBufThreshTrigger, -1, 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| - ^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, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action| - ^FluidNRTProcess.new( - server, this, action, [destination], blocking:1 - ).process( - source, startFrame, numFrames, startChan, numChans, destination, threshold + source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination], + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, threshold, 0], freeWhenDone, action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, action| - ^process( - source, startFrame, numFrames, startChan, numChans, destination, threshold - ); + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, threshold = 0, freeWhenDone = true, action| + + source = source.asUGenInput; + destination = destination.asUGenInput; + + source.isNil.if {"FluidBufThresh: Invalid source buffer".throw}; + destination.isNil.if {"FluidBufThresh: Invalid destination buffer".throw}; + + ^this.new( + server, nil, [destination], + ).processList( + [source, startFrame, numFrames, startChan, numChans, destination, threshold, 1], freeWhenDone, action + ); + } } diff --git a/release-packaging/Classes/FluidBufTransientSlice.sc b/release-packaging/Classes/FluidBufTransientSlice.sc index e68d043..8e7a5e1 100644 --- a/release-packaging/Classes/FluidBufTransientSlice.sc +++ b/release-packaging/Classes/FluidBufTransientSlice.sc @@ -1,30 +1,43 @@ -FluidBufTransientSlice : UGen{ - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0| +FluidBufTransientSlice : FluidBufProcessor { - source = source.asUGenInput; - indices = indices.asUGenInput; + *objectClassName{^\FluidBufTrSlice} - source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; - indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0| - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength, trig, blocking); - } + source = source.asUGenInput; + indices = indices.asUGenInput; + + source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, trig = 1, blocking = 0| - ^this.multiNew(\control, 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); } - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, action| - ^FluidNRTProcess.new( - server, this, action,[indices] - ).process(source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, freeWhenDone = true, action| + + source = source.asUGenInput; + indices = indices.asUGenInput; + + source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; + + ^this.new( + server, nil,[indices] + ).processList([source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength,0], freeWhenDone, action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, action| - ^FluidNRTProcess.new( - server, this, action,[indices], blocking: 1 - ).process(source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, minSliceLength = 1000, freeWhenDone = true, action| + + source = source.asUGenInput; + indices = indices.asUGenInput; + + source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw}; + indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw}; + + ^this.new( + server, nil,[indices] + ).processList([source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength,1], freeWhenDone, action ); } } diff --git a/release-packaging/Classes/FluidBufTransients.sc b/release-packaging/Classes/FluidBufTransients.sc index e87f167..c20f73a 100644 --- a/release-packaging/Classes/FluidBufTransients.sc +++ b/release-packaging/Classes/FluidBufTransients.sc @@ -1,36 +1,43 @@ -FluidBufTransients : UGen { +FluidBufTransients : FluidBufProcessor { + *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0| - *new1 { |rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0 | + source = source.asUGenInput; + transients = transients ? -1; + residual = residual ? -1; - source = source.asUGenInput; - transients = transients.asUGenInput; - residual = residual.asUGenInput; + source.isNil.if {"FluidBufTransients: Invalid source buffer".throw}; - source.isNil.if {"FluidBufTransients: Invalid source buffer".throw}; - - ^super.new1(rate, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking); + ^FluidProxyUgen.kr(\FluidBufTransientsTrigger, -1, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking); } + *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action| - *kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, trig = 1, blocking = 0| - ^this.multiNew(\control, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, trig, blocking); + source = source.asUGenInput; + transients = transients ? -1; + residual = residual ? -1; - } + source.isNil.if {"FluidBufTransients: Invalid source buffer".throw}; - *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action| - ^FluidNRTProcess.new( - server, this, action,[transients, residual].select{|x| x!= -1} - ).process( - source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength + ^this.new( + server, nil,[transients, residual].select{|x| x!= -1} + ).processList( + [source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,0],freeWhenDone,action ); } - *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action| - ^FluidNRTProcess.new( - server, this, action,[transients, residual].select{|x| x!= -1}, blocking: 1 - ).process( - source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength - ); - } + *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients = -1, residual = -1, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, freeWhenDone = true, action| + + source = source.asUGenInput; + transients = transients ? -1; + residual = residual ? -1; + + source.isNil.if {"FluidBufTransients: Invalid source buffer".throw}; + + ^this.new( + server, nil,[transients, residual].select{|x| x!= -1} + ).processList( + [source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength,1],freeWhenDone = true,action + ); + } } diff --git a/release-packaging/Classes/FluidDataSet.sc b/release-packaging/Classes/FluidDataSet.sc index 6d1dea1..277657b 100644 --- a/release-packaging/Classes/FluidDataSet.sc +++ b/release-packaging/Classes/FluidDataSet.sc @@ -1,91 +1,64 @@ -FluidDataSetExistsError : Exception{ -} - -FluidDataSet : FluidManipulationClient { +FluidDataSet : FluidDataObject +{ - var numNeighbours, <>weight; *new {|server, numNeighbours = 3, weight = 1| - ^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]); + ^super.new(server,[numNeighbours,weight]) + .numNeighbours_(numNeighbours) + .weight_(weight); } + prGetParams{^[this.numNeighbours,this.weight,-1,-1];} + + fitMsg{|dataSet, labelSet| + ^this.prMakeMsg(\fit, id, dataSet.id, labelSet.id) + } + fit{|dataSet, labelSet, action| - this.prSendMsg(\fit,[dataSet.asSymbol, labelSet.asSymbol], action); + actions[\fit] = [nil,action]; + this.prSendMsg(this.fitMsg(dataSet, labelSet)); } - predict{|dataSet, labelSet, action| - this.prSendMsg(\predict, - [dataSet.asSymbol, labelSet.asSymbol], - action); + predictMsg{|dataSet, labelSet| + ^this.prMakeMsg(\predict, id, dataSet.id, labelSet.id) + } + + predict{|dataSet, labelSet, action| + actions[\predict] = [nil, action]; + this.prSendMsg(this.predictMsg(dataSet, labelSet)); } + predictPointMsg{|buffer| + ^this.prMakeMsg(\predictPoint, id, this.prEncodeBuffer(buffer)) + } + predictPoint {|buffer, action| - buffer = this.prEncodeBuffer(buffer); - this.prSendMsg(\predictPoint, - [buffer.asUGenInput], action, - [string(FluidMessageResponse,_,_)] - ); + actions[\predictPoint] = [string(FluidMessageResponse,_,_),action]; + this.prSendMsg(this.predictPointMsg(buffer)); } + + kr{|trig, inputBuffer,outputBuffer| + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, this.numNeighbours, this.weight, + this.prEncodeBuffer(inputBuffer), + this.prEncodeBuffer(outputBuffer)); + } + } diff --git a/release-packaging/Classes/FluidKNNRegressor.sc b/release-packaging/Classes/FluidKNNRegressor.sc index 1209a27..a6a7cad 100644 --- a/release-packaging/Classes/FluidKNNRegressor.sc +++ b/release-packaging/Classes/FluidKNNRegressor.sc @@ -1,25 +1,46 @@ -FluidKNNRegressor : FluidRTDataClient { +FluidKNNRegressor : FluidRealTimeModel { + + var <>numNeighbours, <>weight; *new {|server, numNeighbours = 3, weight = 1| - ^super.new1(server,[\numNeighbours,numNeighbours,\weight,weight]); + ^super.new(server,[numNeighbours,weight]) + .numNeighbours_(numNeighbours) + .weight_(weight); } + prGetParams{^[this.numNeighbours,this.weight,-1,-1];} + + fitMsg{|sourceDataSet, targetDataSet| + ^this.prMakeMsg(\fit,this.id,sourceDataSet.id,targetDataSet.id) + } + fit{|sourceDataSet, targetDataSet, action| - this.prSendMsg(\fit, - [sourceDataSet.asSymbol, targetDataSet.asSymbol], - action - ); + actions[\fit] = [nil,action]; + this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet)); } + predictMsg{ |sourceDataSet, targetDataSet| + ^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id) + } + predict{ |sourceDataSet, targetDataSet,action| - this.prSendMsg(\predict, - [sourceDataSet.asSymbol, targetDataSet.asSymbol], - action); + actions[\predict] = [nil, action]; + this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet)); } + predictPointMsg { |buffer| + ^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer)); + } + predictPoint { |buffer, action| - buffer = this.prEncodeBuffer(buffer); - this.prSendMsg(\predictPoint, [buffer], action, - [number(FluidMessageResponse,_,_)]); + actions[\predictPoint] = [number(FluidMessageResponse,_,_),action]; + this.prSendMsg(this.predictPointMsg(buffer)); } + + kr{|trig, inputBuffer,outputBuffer| + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, this.numNeighbours, this.weight, + this.prEncodeBuffer(inputBuffer), + this.prEncodeBuffer(outputBuffer)); + } } diff --git a/release-packaging/Classes/FluidLabelSet.sc b/release-packaging/Classes/FluidLabelSet.sc index cd715fa..75e48f5 100644 --- a/release-packaging/Classes/FluidLabelSet.sc +++ b/release-packaging/Classes/FluidLabelSet.sc @@ -1,81 +1,52 @@ -FluidLabelSetExistsError : Exception{ -} - -FluidLabelSet : FluidManipulationClient { - - var numDimensions, <>distanceMetric; + *new {|server,numDimensions = 2, distanceMetric = 1| - ^super.new1(server,[ - \numDimensions,numDimensions, - \distanceMetric, distanceMetric - ]) + ^super.new(server,[numDimensions, distanceMetric]) + .numDimensions_(numDimensions) + .distanceMetric_(distanceMetric); } + prGetParams{ + ^[this.numDimensions, this.distanceMetric]; + } + + fitTransformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\fitTransform,id, sourceDataSet.id, destDataSet.id); + } fitTransform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\fitTransform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action); + actions[\fitTransform] = [nil,action]; + this.fitTransformMsg(sourceDataSet,destDataSet).postln; + + this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet)); } // not implemented diff --git a/release-packaging/Classes/FluidMFCC.sc b/release-packaging/Classes/FluidMFCC.sc index 76d37b6..326c7e6 100644 --- a/release-packaging/Classes/FluidMFCC.sc +++ b/release-packaging/Classes/FluidMFCC.sc @@ -4,6 +4,7 @@ FluidMFCC : MultiOutUGen { ^this.multiNew('control', in.asAudioRateInput(this), numCoeffs, numBands, minFreq, maxFreq, maxNumCoeffs, windowSize, hopSize, fftSize, maxFFTSize); } + init {arg ...theInputs; inputs = theInputs; ^this.initOutputs(inputs.at(5),rate); diff --git a/release-packaging/Classes/FluidMLP.sc b/release-packaging/Classes/FluidMLP.sc index 1d7a846..b7fef0e 100644 --- a/release-packaging/Classes/FluidMLP.sc +++ b/release-packaging/Classes/FluidMLP.sc @@ -1,103 +1,151 @@ -FluidMLPRegressor : FluidRTDataClient { +FluidMLPRegressor : FluidRealTimeModel { const hidden, <>activation, <>outputActivation, <>tapIn, <>tapOut, <>maxIter, <>learnRate, <>momentum, <>batchSize, <>validation; + *new {|server, hidden = #[3,3] , activation = 2, outputActivation = 0, tapIn = 0, tapOut = -1,maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2| - var hiddenCtrlLabels; - hidden = [hidden.size]++hidden; - - hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i}; - - ^super.new1(server, - [hiddenCtrlLabels,hidden].lace ++ - [ - \activation,activation, - \outputActivation, outputActivation, - \tapIn, tapIn, - \tapOut, tapOut, - \maxIter, maxIter, - \learnRate,learnRate, - \momentum, momentum, - \batchsize,batchSize, - \validation,validation, - ]) + + ^super.new(server, [hidden.size] ++ hidden ++ [activation, outputActivation, tapIn, tapOut, maxIter, learnRate, momentum, batchSize, validation]) + .hidden_(hidden) + .activation_(activation) + .outputActivation_(outputActivation) + .tapIn_(tapIn) + .tapOut_(tapOut) + .maxIter_(maxIter) + .learnRate_(learnRate) + .momentum_(momentum) + .batchSize_(batchSize) + .validation_(validation); } - clear{ |action| - this.prSendMsg(\clear,action:action); + prGetParams{ + ^[this.hidden.size] ++ this.hidden ++ [this.activation, this.outputActivation, this.tapIn, this.tapOut, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1] + } + + clearMsg{ ^this.prMakeMsg(\clear, id) } + + clear{ |action| + actions[\clear] = [nil, action]; + this.prSendMsg(this.clearMsg); } + fitMsg{|sourceDataSet, targetDataSet| + ^this.prMakeMsg(\fit,id,sourceDataSet.id, targetDataSet.id); + } + fit{|sourceDataSet, targetDataSet, action| - this.prSendMsg(\fit, - [sourceDataSet.asSymbol, targetDataSet.asSymbol], - action,numbers(FluidMessageResponse,_,1,_) - ); + actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action]; + this.prSendMsg(this.fitMsg(sourceDataSet,targetDataSet)); } - predict{ |sourceDataSet, targetDataSet, action| - this.prSendMsg(\predict, - [sourceDataSet.asSymbol, targetDataSet.asSymbol], - action); + predictMsg{|sourceDataSet, targetDataSet| + ^this.prMakeMsg(\predict,id,sourceDataSet.id, targetDataSet.id); + } + + predict{|sourceDataSet, targetDataSet, action| + actions[\predict] = [nil,action]; + this.prSendMsg(this.predictMsg(sourceDataSet,targetDataSet)); } + + predictPointMsg { |sourceBuffer, targetBuffer| + ^this.prMakeMsg(\predictPoint,id, + this.prEncodeBuffer(sourceBuffer), + this.prEncodeBuffer(targetBuffer), + ["/b_query", targetBuffer.asUGenInput]); + } + predictPoint { |sourceBuffer, targetBuffer, action| - sourceBuffer = this.prEncodeBuffer(sourceBuffer); - targetBuffer = this.prEncodeBuffer(targetBuffer); - this.prSendMsg(\predictPoint, - [sourceBuffer.asUGenInput, targetBuffer.asUGenInput], action,outputBuffers:[targetBuffer]); + actions[\predictPoint] = [nil,{action.value(targetBuffer)}]; + this.predictPointMsg(sourceBuffer, targetBuffer).postln; + this.prSendMsg(this.predictPointMsg(sourceBuffer, targetBuffer)); } + + kr{|trig, inputBuffer,outputBuffer, tapIn = 0, tapOut = -1| + var params; + tapIn = tapIn ? this.tapIn; + tapOut = tapOut ? this.tapOut; + + this.tapIn_(tapIn).tapOut_(tapOut); + + params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer), + this.prEncodeBuffer(outputBuffer)]; + + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, *params); + } + } -FluidMLPClassifier : FluidRTDataClient { +FluidMLPClassifier : FluidRealTimeModel { const hidden, <>activation, <> maxIter, <>learnRate, <> momentum, <>batchSize, <>validation; + *new {|server, hidden = #[3,3] , activation = 2, maxIter = 1000, learnRate = 0.0001, momentum = 0.9, batchSize = 50, validation = 0.2| - var hiddenCtrlLabels; - hidden = [hidden.size]++hidden; - - hiddenCtrlLabels = hidden.collect{|x,i| \hidden++i}; - - ^super.new1(server, - [hiddenCtrlLabels,hidden].lace ++ - [ - \activation,activation, - \maxIter, maxIter, - \learnRate,learnRate, - \momentum, momentum, - \batchsize,batchSize, - \validation,validation, - ]) + ^super.new(server,[hidden.size] ++ hidden ++ [activation, maxIter, learnRate, momentum, batchSize, validation]) + .hidden_(hidden) + .activation_(activation) + .maxIter_(maxIter) + .learnRate_(learnRate) + .momentum_(momentum) + .batchSize_(batchSize) + .validation_(validation); } + prGetParams{ + ^[ this.hidden.size] ++ this.hidden ++ [this.activation, this.maxIter, this.learnRate, this.momentum, this.batchSize, this.validation, -1, -1]; + } + + clearMsg{ ^this.prMakeMsg(\clear,id) } + clear{ |action| - this.prSendMsg(\clear,action:action); + actions[\clear] = [nil,action]; + this.prSendMsg(this.clearMsg); } + fitMsg{|sourceDataSet, targetLabelSet| + ^this.prMakeMsg(\fit,id,sourceDataSet.id, targetLabelSet.id); + } fit{|sourceDataSet, targetLabelSet, action| - this.prSendMsg(\fit, - [sourceDataSet.asSymbol, targetLabelSet.asSymbol], - action,numbers(FluidMessageResponse,_,1,_) - ); + actions[\fit] = [numbers(FluidMessageResponse,_,1,_),action]; + this.prSendMsg(this.fitMsg(sourceDataSet,targetLabelSet)); } + predictMsg{|sourceDataSet, targetLabelSet| + ^this.prMakeMsg(\predict,id,sourceDataSet.id, targetLabelSet.id); + } + predict{ |sourceDataSet, targetLabelSet, action| - this.prSendMsg(\predict, - [sourceDataSet.asSymbol, targetLabelSet.asSymbol], - action); + actions[\predict]=[nil,action]; + this.prSendMsg(this.predictMsg(sourceDataSet,targetLabelSet)); } + predictPointMsg { |sourceBuffer| + ^this.prMakeMsg(\predictPoint,id,this.prEncodeBuffer(sourceBuffer)) + } + predictPoint { |sourceBuffer, action| - sourceBuffer = this.prEncodeBuffer(sourceBuffer); - this.prSendMsg(\predictPoint, - [sourceBuffer], action, string(FluidMessageResponse,_,_)); + actions[\predictPoint] = [string(FluidMessageResponse,_,_),action]; + this.prSendMsg(this.predictPointMsg(sourceBuffer)); } + + kr{|trig, inputBuffer,outputBuffer| + + var params = this.prGetParams.drop(-2) ++ [this.prEncodeBuffer(inputBuffer), + this.prEncodeBuffer(outputBuffer)]; + + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, *params); + } } diff --git a/release-packaging/Classes/FluidManipulationClient.sc b/release-packaging/Classes/FluidManipulationClient.sc deleted file mode 100644 index c39bebb..0000000 --- a/release-packaging/Classes/FluidManipulationClient.sc +++ /dev/null @@ -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 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 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) }; - } - -} diff --git a/release-packaging/Classes/FluidManipulationJSON.sc b/release-packaging/Classes/FluidManipulationJSON.sc index 68f3aa0..875902b 100644 --- a/release-packaging/Classes/FluidManipulationJSON.sc +++ b/release-packaging/Classes/FluidManipulationJSON.sc @@ -1,4 +1,4 @@ -+ FluidManipulationClient { ++ FluidDataObject { tmpJSONFilename{ ^Platform.defaultTempDir++"tmp_fluid_data_"++ Date.localtime.stamp++"_"++UniqueID.next++".json"; @@ -6,8 +6,8 @@ dump {|action| var filename = this.tmpJSONFilename; - action ?? {action = postit}; - this.write(filename, { + action ?? {action = postResponse}; + this.write(filename, { action.value(this.parseJSON(File.readAllString(filename))); File.delete(filename); }); diff --git a/release-packaging/Classes/FluidMessageResponse.sc b/release-packaging/Classes/FluidMessageResponse.sc index 7ea2317..10d19e4 100644 --- a/release-packaging/Classes/FluidMessageResponse.sc +++ b/release-packaging/Classes/FluidMessageResponse.sc @@ -38,7 +38,7 @@ FluidMessageResponse : Object } *buffer{ |a,server,offset| - server = server ? Server.default ; + server = server ? Server.default ; ^[Buffer.cachedBufferAt(server, a[offset]), offset + 1] } -} \ No newline at end of file +} diff --git a/release-packaging/Classes/FluidNormalize.sc b/release-packaging/Classes/FluidNormalize.sc index 8881930..17d5c5a 100644 --- a/release-packaging/Classes/FluidNormalize.sc +++ b/release-packaging/Classes/FluidNormalize.sc @@ -1,31 +1,68 @@ -FluidNormalize : FluidRTDataClient { +FluidNormalize : FluidRealTimeModel { + + var <>min, <>max, <>invert; *new {|server, min = 0, max = 1, invert = 0| - ^super.new1(server,[\min,min,\max,max, \invert, invert]); + ^super.new(server,[min,max,invert]) + .min_(min).max_(max).invert_(invert); } + prGetParams{ + ^[this.min,this.max,this.invert,-1,-1]; + } + + + fitMsg{|dataSet| + ^this.prMakeMsg(\fit,id,dataSet.id) + } + fit{|dataSet, action| - this.prSendMsg(\fit,[dataSet.asSymbol], action); + actions[\fit] = [nil,action]; + this.prSendMsg(this.fitMsg(dataSet)); } + transformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id); + } + transform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\transform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action - ); + actions[\transform] = [nil,action]; + this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet)); } + fitTransformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id) + } + fitTransform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\fitTransform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action - ); + actions[\fitTransform] = [nil,action]; + this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet)); } + transformPointMsg{|sourceBuffer, destBuffer| + ^this.prMakeMsg(\transformPoint,id, + this.prEncodeBuffer(sourceBuffer), + this.prEncodeBuffer(destBuffer), + ["/b_query",destBuffer.asUGenInput] + ); + } + transformPoint{|sourceBuffer, destBuffer, action| - sourceBuffer = this.prEncodeBuffer(sourceBuffer); - destBuffer = this.prEncodeBuffer(destBuffer); - this.prSendMsg(\transformPoint, - [sourceBuffer, destBuffer], action, - outputBuffers:[destBuffer] - ); + actions[\transformPoint] = [nil,{action.value(destBuffer)}]; + this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer)); } + + kr{|trig, inputBuffer,outputBuffer,min,max,invert| + + min = min ? this.min; + max = max ? this.max; + invert = invert ? this.invert; + + this.min_(min).max_(max).invert_(invert); + + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, this.min, this.max, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer)); + } + + } diff --git a/release-packaging/Classes/FluidPCA.sc b/release-packaging/Classes/FluidPCA.sc index 899d6e0..94c7df3 100644 --- a/release-packaging/Classes/FluidPCA.sc +++ b/release-packaging/Classes/FluidPCA.sc @@ -1,24 +1,62 @@ -FluidPCA : FluidRTDataClient { +FluidPCA : FluidRealTimeModel{ - *new {|server, numDimensions = 2| - ^super.new1(server,[\numDimensions,numDimensions]); - } + var <>numDimensions; + + *new {|server, numDimensions = 2| + ^super.new(server,[numDimensions]).numDimensions_(numDimensions); + } + + prGetParams{ + ^[numDimensions,-1,-1]; + } + + fitMsg{|dataSet| + ^this.prMakeMsg(\fit,id, dataSet.id); + } fit{|dataSet, action| - this.prSendMsg(\fit,[dataSet.asSymbol], action); + actions[\fit] = [nil, action]; + this.prSendMsg(this.fitMsg(dataSet)); + } + + transformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\transform, id, sourceDataSet.id, destDataSet.id); } transform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\transform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]); + actions[\transform] = [numbers(FluidMessageResponse,_,1,_),action]; + this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet)); + } + + fitTransformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\fitTransform,id, sourceDataSet.id, destDataSet.id); } fitTransform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\fitTransform,[sourceDataSet.asSymbol, destDataSet.asSymbol], action, [numbers(FluidMessageResponse,_,1,_)]); + actions[\fitTransform] = [numbers(FluidMessageResponse,_,1,_),action]; + this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet)); + } + + transformPointMsg{|sourceBuffer, destBuffer| + ^this.prMakeMsg(\transformPoint,id, + this.prEncodeBuffer(sourceBuffer), + this.prEncodeBuffer(destBuffer), + ["/b_query",destBuffer.asUGenInput] + ); } transformPoint{|sourceBuffer, destBuffer, action| - sourceBuffer = this.prEncodeBuffer(sourceBuffer); - destBuffer = this.prEncodeBuffer(destBuffer); - this.prSendMsg(\transformPoint,[sourceBuffer, destBuffer], action, outputBuffers:[destBuffer]); + actions[\transformPoint] = [nil,{action.value(destBuffer)}]; + this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer)); + } + + kr{|trig, inputBuffer,outputBuffer,numDimensions| + + numDimensions = numDimensions ? this.numDimensions; + this.numDimensions_(numDimensions); + + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, this.numDimensions, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer)); } + } diff --git a/release-packaging/Classes/FluidServerCache.sc b/release-packaging/Classes/FluidServerCache.sc new file mode 100644 index 0000000..a5da9a0 --- /dev/null +++ b/release-packaging/Classes/FluidServerCache.sc @@ -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 invert; + + *new {|server, invert = 0| + ^super.new(server,[invert]).invert_(invert); } - fit{|dataSet, action| - this.prSendMsg(\fit, [dataSet.asSymbol], action); + prGetParams{ + ^[this.invert, -1, 1]; + } + + fitMsg{|dataSet| + ^this.prMakeMsg(\fit,id,dataSet.id); + } + + fit{|dataSet, action| + actions[\fit] = [nil, action]; + this.prSendMsg(this.fitMsg(dataSet)); } + transformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id); + } + transform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\transform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action - ); + actions[\transform] = [nil,action]; + this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet)); } + fitTransformMsg{|sourceDataSet, destDataSet| + ^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id) + } + fitTransform{|sourceDataSet, destDataSet, action| - this.prSendMsg(\fitTransform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action - ); + actions[\fitTransform] = [nil,action]; + this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet)); } + + transformPointMsg{|sourceBuffer, destBuffer| + ^this.prMakeMsg(\transformPoint, id, this.prEncodeBuffer(sourceBuffer), this.prEncodeBuffer(destBuffer),["/b_query",destBuffer.asUGenInput]); + } + transformPoint{|sourceBuffer, destBuffer, action| - sourceBuffer = this.prEncodeBuffer(sourceBuffer); - destBuffer = this.prEncodeBuffer(destBuffer); - this.prSendMsg(\transformPoint, - [sourceBuffer, destBuffer], action, outputBuffers:[destBuffer] - ); + actions[\transformPoint] = [nil, {action.value(destBuffer)}]; + this.prSendMsg(this.transformPointMsg(sourceBuffer,destBuffer)); } + + kr{|trig, inputBuffer,outputBuffer,invert| + + invert = invert ? this.invert; + this.invert_(invert); + + ^FluidProxyUgen.kr(this.class.name.asString++'/query', K2A.ar(trig), + id, this.invert, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer)); + } } diff --git a/release-packaging/Classes/FluidUMAP.sc b/release-packaging/Classes/FluidUMAP.sc index b47aa08..9083a3f 100644 --- a/release-packaging/Classes/FluidUMAP.sc +++ b/release-packaging/Classes/FluidUMAP.sc @@ -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| - ^super.new1(server,[ - \numDimensions,numDimensions, - \numNeighbours, numNeighbours, - \minDist, minDist, - \iterations, iterations, - \learnRate, learnRate, - \batchSize, batchSize - ]) + ^super.new(server,[numDimensions, numNeighbours, minDist, iterations, learnRate, batchSize]) + .numDimensions_(numDimensions) + .numNeighbours_(numNeighbours) + .minDist_(minDist) + .iterations_(iterations) + .learnRate_(learnRate) + .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| - this.prSendMsg(\fitTransform, - [sourceDataSet.asSymbol, destDataSet.asSymbol], action); + actions[\fitTransform] = [nil, action]; + this.prSendMsg(this.fitTransformMsg(sourceDataSet,destDataSet)); } // not implemented