Classes: uniform sc default indentation (#134)
SuperCollider code defaults to indentation using tab. All sc codebase is formatted like this. Here I just opened every .sc file in scide, selected all code, and automatically indent it pressing Tab.nix
parent
2678173661
commit
17067137fd
@ -1,44 +1,44 @@
|
|||||||
FluidBufAmpGate : FluidBufProcessor {
|
FluidBufAmpGate : FluidBufProcessor {
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, trig = 1, blocking = 0|
|
*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));
|
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);
|
^FluidProxyUgen.kr(\FluidBufAmpGateTrigger,-1, source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq,maxSize, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||||
|
|
||||||
|
|
||||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||||
|
|
||||||
source = source ? -1;
|
source = source ? -1;
|
||||||
indices = indices ? -1;
|
indices = indices ? -1;
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [indices]
|
server, nil, [indices]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, indices, rampUp, rampDown, onThreshold, offThreshold, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, highPassFreq, maxSize, 0],freeWhenDone,action
|
[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, freeWhenDone = true, action |
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, rampUp = 10, rampDown = 10, onThreshold = -90, offThreshold = -90, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, highPassFreq = 85, freeWhenDone = true, action |
|
||||||
|
|
||||||
|
|
||||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||||
|
|
||||||
|
source = source ? -1;
|
||||||
|
indices = indices ? -1;
|
||||||
|
|
||||||
source = source ? -1;
|
^this.new(
|
||||||
indices = indices ? -1;
|
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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
^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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
FluidBufAmpGateTrigger : FluidProxyUgen {}
|
FluidBufAmpGateTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,49 +1,49 @@
|
|||||||
FluidBufChroma : FluidBufProcessor {
|
FluidBufChroma : FluidBufProcessor {
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufChromaTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufChromaTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, 0],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, 0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numChroma = 12, ref = 440, normalize = 0,minFreq = 0,maxFreq = -1, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufChroma: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufChroma: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, 1],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numChroma, numChroma, ref, normalize, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize, 1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufChromaTrigger : FluidProxyUgen {}
|
FluidBufChromaTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,39 +1,39 @@
|
|||||||
FluidBufCompose : FluidBufProcessor {
|
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|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, trig = 1, blocking = 1|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
|
||||||
destination = destination.asUGenInput;
|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
source = source.asUGenInput;
|
||||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufComposeTrigger,-1, source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, trig, blocking);
|
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||||
|
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(\FluidBufComposeTrigger,-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, freeWhenDone = true, action|
|
*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;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||||
|
|
||||||
^this.new( server, nil, [destination]).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);//NB always blocking
|
^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, freeWhenDone = true, action|
|
*processBlocking { |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 = source.asUGenInput;
|
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||||
destination = destination.asUGenInput;
|
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||||
|
|
||||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
^this.new(
|
||||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
server, nil, [destination]
|
||||||
|
).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);
|
||||||
^this.new(
|
|
||||||
server, nil, [destination]
|
|
||||||
).processList([source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain, 1], freeWhenDone, action);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufComposeTrigger : FluidProxyUgen {}
|
FluidBufComposeTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,47 +1,47 @@
|
|||||||
FluidBufFlatten : FluidBufProcessor {
|
FluidBufFlatten : FluidBufProcessor {
|
||||||
|
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, trig = 1, blocking = 1|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, trig = 1, blocking = 1|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, startFrame, numFrames, startChan, numChans, destination, axis, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufFlattenTrigger,-1, source, startFrame, numFrames, startChan, numChans, destination, axis, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, freeWhenDone = true, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [destination],
|
server, nil, [destination],
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, destination, axis,0],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, destination, axis,0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, freeWhenDone = true, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, axis = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufFlatten: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufFlatten: Invalid destination buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [destination],
|
server, nil, [destination],
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, destination, axis,1],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, destination, axis,1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufFlattenTrigger : FluidProxyUgen {}
|
FluidBufFlattenTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,76 +1,76 @@
|
|||||||
FluidBufLoudness : FluidBufProcessor{
|
FluidBufLoudness : FluidBufProcessor{
|
||||||
|
|
||||||
const <features=#[\loudness, \peak];
|
const <features=#[\loudness, \peak];
|
||||||
classvar featuresLookup;
|
classvar featuresLookup;
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
||||||
}
|
}
|
||||||
|
|
||||||
*prWarnUnrecognised {|sym| ("WARNING: FluidLoudness -" + sym + "is not a recognised option").postln}
|
*prWarnUnrecognised {|sym| ("WARNING: FluidLoudness -" + sym + "is not a recognised option").postln}
|
||||||
|
|
||||||
*prProcessSelect {|a|
|
*prProcessSelect {|a|
|
||||||
var bits;
|
var bits;
|
||||||
a.asBag.countsDo{|item,count,i|
|
a.asBag.countsDo{|item,count,i|
|
||||||
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
||||||
};
|
};
|
||||||
bits = a.collect{ |sym|
|
bits = a.collect{ |sym|
|
||||||
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
||||||
}.reduce{|x,y| x | y};
|
}.reduce{|x,y| x | y};
|
||||||
^bits
|
^bits
|
||||||
}
|
}
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, trig = 1, blocking = 0|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
var maxwindowSize = windowSize.nextPowerOfTwo;
|
var maxwindowSize = windowSize.nextPowerOfTwo;
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
||||||
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufLoudnessTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufLoudnessTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, freeWhenDone = true, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
var maxwindowSize = windowSize.nextPowerOfTwo;
|
var maxwindowSize = windowSize.nextPowerOfTwo;
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
||||||
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,0],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, padding = 1, freeWhenDone = true, action|
|
var maxwindowSize = windowSize.nextPowerOfTwo;
|
||||||
|
|
||||||
var maxwindowSize = windowSize.nextPowerOfTwo;
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
source.isNil.if {"%: Invalid source buffer".format(this.class.name).throw};
|
||||||
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
features.isNil.if {"%: Invalid features buffer".format(this.class.name).throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features,padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,1],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features,padding, selectbits, kWeighting, truePeak, windowSize, hopSize, maxwindowSize,1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufLoudnessTrigger : FluidProxyUgen {}
|
FluidBufLoudnessTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,46 +1,46 @@
|
|||||||
FluidBufMFCC : FluidBufProcessor{
|
FluidBufMFCC : FluidBufProcessor{
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufMFCCTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufMFCCTrigger, -1, source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone=true, action |
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone=true, action |
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil,[features]
|
server, nil,[features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,0],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,0],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone=true, action |
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numCoeffs = 13, numBands = 40, startCoeff = 0, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone=true, action |
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMFCC: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMFCC: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil,[features]
|
server, nil,[features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,1],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numCoeffs, numCoeffs, numBands, numBands, startCoeff, minFreq, maxFreq, windowSize, hopSize, fftSize, maxFFTSize,1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufMFCCTrigger : FluidProxyUgen {}
|
FluidBufMFCCTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,51 +1,51 @@
|
|||||||
FluidBufMelBands : FluidBufProcessor {
|
FluidBufMelBands : FluidBufProcessor {
|
||||||
|
|
||||||
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
*kr { |source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||||
|
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufMelBandsTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, windowSize, hopSize, fftSize, maxFFTSize, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufMelBandsTrigger,-1, source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, 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, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, windowSize, hopSize, fftSize, maxFFTSize, 0],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, 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, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, normalize = 1, scale = 0, windowSize = 1024, hopSize = -1, fftSize = -1, padding = 1, freeWhenDone = true, action|
|
||||||
|
|
||||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
features = features.asUGenInput;
|
features = features.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufMelBands: Invalid source buffer".throw};
|
||||||
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
features.isNil.if {"FluidBufMelBands: Invalid features buffer".throw};
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [features]
|
server, nil, [features]
|
||||||
).processList(
|
).processList(
|
||||||
[source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, windowSize, hopSize, fftSize, maxFFTSize, 1],freeWhenDone,action
|
[source, startFrame, numFrames, startChan, numChans, features, padding, numBands, numBands, minFreq, maxFreq, normalize, scale, windowSize, hopSize, fftSize, maxFFTSize, 1],freeWhenDone,action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufMelBandsTrigger : FluidProxyUgen {}
|
FluidBufMelBandsTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,37 +1,37 @@
|
|||||||
FluidBufNMF : FluidBufProcessor
|
FluidBufNMF : FluidBufProcessor
|
||||||
{
|
{
|
||||||
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, resynthMode = 0, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, resynthMode = 0, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, trig = 1, blocking = 0|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
resynth = resynth ? -1;
|
resynth = resynth ? -1;
|
||||||
bases = bases ? -1;
|
bases = bases ? -1;
|
||||||
activations = activations ? -1;
|
activations = activations ? -1;
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1,source.asUGenInput, startFrame, numFrames, startChan, numChans, resynth.asUGenInput, resynthMode, bases.asUGenInput, basesMode, activations.asUGenInput, actMode, components, iterations, windowSize, hopSize, fftSize, fftSize, trig, blocking);
|
^FluidProxyUgen.kr(\FluidBufNMFTrigger,-1,source.asUGenInput, startFrame, numFrames, startChan, numChans, resynth.asUGenInput, resynthMode, bases.asUGenInput, basesMode, activations.asUGenInput, actMode, components, iterations, windowSize, hopSize, fftSize, fftSize, trig, blocking);
|
||||||
}
|
}
|
||||||
|
|
||||||
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, resynthMode = 0, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action|
|
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, resynthMode = 0, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
resynth = resynth ? -1;
|
resynth = resynth ? -1;
|
||||||
bases = bases ? -1;
|
bases = bases ? -1;
|
||||||
activations = activations ? -1;
|
activations = activations ? -1;
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||||
).processList([source, startFrame, numFrames, startChan, numChans, resynth, resynthMode, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, fftSize, 0],freeWhenDone,action);
|
).processList([source, startFrame, numFrames, startChan, numChans, resynth, resynthMode, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, fftSize, 0],freeWhenDone,action);
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, resynthMode = 0, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action|
|
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, resynthMode = 0, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1,freeWhenDone = true, action|
|
||||||
|
|
||||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||||
resynth = resynth ? -1;
|
resynth = resynth ? -1;
|
||||||
bases = bases ? -1;
|
bases = bases ? -1;
|
||||||
activations = activations ? -1;
|
activations = activations ? -1;
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
server,nil,[resynth, bases, activations].select{|x| x!= -1}
|
||||||
).processList([source, startFrame, numFrames, startChan, numChans, resynth, resynthMode, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, fftSize, 1],freeWhenDone,action);
|
).processList([source, startFrame, numFrames, startChan, numChans, resynth, resynthMode, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, fftSize, 1],freeWhenDone,action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufNMFTrigger : FluidProxyUgen {}
|
FluidBufNMFTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,62 +1,62 @@
|
|||||||
FluidBufSelect : FluidBufProcessor {
|
FluidBufSelect : FluidBufProcessor {
|
||||||
|
|
||||||
*kr { |source, destination, indices=#[-1], channels=#[-1], trig = 1, blocking = 1|
|
*kr { |source, destination, indices=#[-1], channels=#[-1], trig = 1, blocking = 1|
|
||||||
|
|
||||||
var params;
|
var params;
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
indices = indices.asArray;
|
indices = indices.asArray;
|
||||||
channels = channels.asArray;
|
channels = channels.asArray;
|
||||||
|
|
||||||
indices = [indices.size] ++ indices;
|
indices = [indices.size] ++ indices;
|
||||||
channels = [channels.size] ++ channels;
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
params = indices ++ channels ++ [trig, blocking]
|
params = indices ++ channels ++ [trig, blocking]
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidBufSelectTrigger,-1, source, destination, *params);
|
^FluidProxyUgen.kr(\FluidBufSelectTrigger,-1, source, destination, *params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
*process { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
*process { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
indices = indices.asArray;
|
indices = indices.asArray;
|
||||||
channels = channels.asArray;
|
channels = channels.asArray;
|
||||||
|
|
||||||
indices = [indices.size] ++ indices;
|
indices = [indices.size] ++ indices;
|
||||||
channels = [channels.size] ++ channels;
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
^this.new(server, nil, [destination]).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
^this.new(server, nil, [destination]).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
||||||
}
|
}
|
||||||
|
|
||||||
*processBlocking { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
*processBlocking { |server, source, destination, indices=#[-1], channels=#[-1], freeWhenDone = true, action|
|
||||||
|
|
||||||
source = source.asUGenInput;
|
source = source.asUGenInput;
|
||||||
destination = destination.asUGenInput;
|
destination = destination.asUGenInput;
|
||||||
|
|
||||||
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
source.isNil.if {"FluidBufSelect: Invalid source buffer".throw};
|
||||||
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
destination.isNil.if {"FluidBufSelect: Invalid destination buffer".throw};
|
||||||
|
|
||||||
indices = indices.asArray;
|
indices = indices.asArray;
|
||||||
channels = channels.asArray;
|
channels = channels.asArray;
|
||||||
|
|
||||||
indices = [indices.size] ++ indices;
|
indices = [indices.size] ++ indices;
|
||||||
channels = [channels.size] ++ channels;
|
channels = [channels.size] ++ channels;
|
||||||
|
|
||||||
|
|
||||||
^this.new(
|
^this.new(
|
||||||
server, nil, [destination]
|
server, nil, [destination]
|
||||||
).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
).processList([source, destination]++ indices ++ channels ++ [1], freeWhenDone, action);//NB always blocking
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluidBufSelectTrigger : FluidProxyUgen {}
|
FluidBufSelectTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,85 +1,84 @@
|
|||||||
|
|
||||||
FluidDataSetQuery : FluidDataObject {
|
FluidDataSetQuery : FluidDataObject {
|
||||||
*new{|server| ^super.new(server) }
|
*new{|server| ^super.new(server) }
|
||||||
|
|
||||||
addColumnMsg { |column|
|
addColumnMsg { |column|
|
||||||
^this.prMakeMsg(\addColumn,id,column);
|
^this.prMakeMsg(\addColumn,id,column);
|
||||||
}
|
}
|
||||||
|
|
||||||
addColumn{|column, action|
|
addColumn{|column, action|
|
||||||
actions[\addColumn] = [nil,action];
|
actions[\addColumn] = [nil,action];
|
||||||
this.prSendMsg(this.addColumnMsg(column));
|
this.prSendMsg(this.addColumnMsg(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
addRangeMsg{|start,count|
|
addRangeMsg{|start,count|
|
||||||
^this.prMakeMsg(\addRange,id,start,count);
|
^this.prMakeMsg(\addRange,id,start,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
addRange{|start, count, action|
|
addRange{|start, count, action|
|
||||||
actions[\addRange] = [nil, action];
|
actions[\addRange] = [nil, action];
|
||||||
this.prSendMsg(this.addRangeMsg(start, count));
|
this.prSendMsg(this.addRangeMsg(start, count));
|
||||||
}
|
}
|
||||||
|
|
||||||
filterMsg{|column, condition, value, action|
|
filterMsg{|column, condition, value, action|
|
||||||
^this.prMakeMsg(\filter,id,column,condition.asSymbol,value);
|
^this.prMakeMsg(\filter,id,column,condition.asSymbol,value);
|
||||||
}
|
}
|
||||||
|
|
||||||
filter{|column, condition, value, action|
|
filter{|column, condition, value, action|
|
||||||
actions[\filter] = [nil, action];
|
actions[\filter] = [nil, action];
|
||||||
this.prSendMsg(this.filterMsg(column, condition, value));
|
this.prSendMsg(this.filterMsg(column, condition, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
andMsg{ |column, condition, value|
|
andMsg{ |column, condition, value|
|
||||||
^this.prMakeMsg(\and,id,column, condition.asSymbol, value);
|
^this.prMakeMsg(\and,id,column, condition.asSymbol, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
and{|column, condition, value, action|
|
and{|column, condition, value, action|
|
||||||
actions[\and] = [nil, action];
|
actions[\and] = [nil, action];
|
||||||
this.prSendMsg(this.andMsg(column,condition,value));
|
this.prSendMsg(this.andMsg(column,condition,value));
|
||||||
}
|
}
|
||||||
|
|
||||||
orMsg{|column, condition, value|
|
orMsg{|column, condition, value|
|
||||||
^this.prMakeMsg(\or,id,column, condition.asSymbol, value)
|
^this.prMakeMsg(\or,id,column, condition.asSymbol, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
or{|column, condition, value, action|
|
or{|column, condition, value, action|
|
||||||
actions[\or] = [nil,action];
|
actions[\or] = [nil,action];
|
||||||
this.prSendMsg(this.orMsg(column, condition, value));
|
this.prSendMsg(this.orMsg(column, condition, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
clearMsg{
|
clearMsg{
|
||||||
^this.prMakeMsg(\clear,id);
|
^this.prMakeMsg(\clear,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear{|action|
|
clear{|action|
|
||||||
actions[\clear] = [nil, action];
|
actions[\clear] = [nil, action];
|
||||||
this.prSendMsg(this.clearMsg);
|
this.prSendMsg(this.clearMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
limitMsg{|rows|
|
limitMsg{|rows|
|
||||||
^this.prMakeMsg(\limit,id,rows);
|
^this.prMakeMsg(\limit,id,rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
limit{|rows, action|
|
limit{|rows, action|
|
||||||
actions[\limit] = [nil,action];
|
actions[\limit] = [nil,action];
|
||||||
this.prSendMsg(this.limitMsg(rows));
|
this.prSendMsg(this.limitMsg(rows));
|
||||||
}
|
}
|
||||||
|
|
||||||
transformMsg{|sourceDataSet, destDataSet|
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
actions[\transform] = [nil,action];
|
actions[\transform] = [nil,action];
|
||||||
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
this.prSendMsg(this.transformMsg(sourceDataSet,destDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
transformJoinMsg{|source1DataSet, source2DataSet, destDataSet|
|
transformJoinMsg{|source1DataSet, source2DataSet, destDataSet|
|
||||||
^this.prMakeMsg(\transformJoin,id,source1DataSet.id, source2DataSet.id, destDataSet.id);
|
^this.prMakeMsg(\transformJoin,id,source1DataSet.id, source2DataSet.id, destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformJoin{|source1DataSet, source2DataSet, destDataSet, action|
|
transformJoin{|source1DataSet, source2DataSet, destDataSet, action|
|
||||||
actions[\transformJoin] = [nil,action];
|
actions[\transformJoin] = [nil,action];
|
||||||
this.prSendMsg(this.transformJoinMsg(source1DataSet, source2DataSet, destDataSet));
|
this.prSendMsg(this.transformJoinMsg(source1DataSet, source2DataSet, destDataSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
FluidDataSetWr : FluidBufProcessor {
|
FluidDataSetWr : FluidBufProcessor {
|
||||||
*kr { |dataset,idPrefix = "", idNumber = 0,buf, trig=1, blocking = 1|
|
*kr { |dataset,idPrefix = "", idNumber = 0,buf, trig=1, blocking = 1|
|
||||||
var args;
|
var args;
|
||||||
buf ?? {(this.class.name ++ ": No input buffer provided").error};
|
buf ?? {(this.class.name ++ ": No input buffer provided").error};
|
||||||
|
|
||||||
idNumber = idNumber !? {[2,1,idNumber.asInteger.asUGenInput]} ?? {[2,0,0]};
|
|
||||||
idPrefix = idPrefix !? {[idPrefix.asString.size] ++ idPrefix.asString.ascii} ?? {0};
|
|
||||||
|
|
||||||
args = [-1] ++ dataset.asUGenInput ++idPrefix ++ idNumber ++ buf.asUGenInput ++ trig ++ blocking;
|
idNumber = idNumber !? {[2,1,idNumber.asInteger.asUGenInput]} ?? {[2,0,0]};
|
||||||
|
idPrefix = idPrefix !? {[idPrefix.asString.size] ++ idPrefix.asString.ascii} ?? {0};
|
||||||
|
|
||||||
^FluidProxyUgen.kr(\FluidDataSetWrTrigger,*args);
|
args = [-1] ++ dataset.asUGenInput ++idPrefix ++ idNumber ++ buf.asUGenInput ++ trig ++ blocking;
|
||||||
|
|
||||||
|
^FluidProxyUgen.kr(\FluidDataSetWrTrigger,*args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidDataSetWrTrigger : FluidProxyUgen {}
|
FluidDataSetWrTrigger : FluidProxyUgen {}
|
||||||
|
|||||||
@ -1,59 +1,59 @@
|
|||||||
FluidKNNRegressor : FluidModelObject {
|
FluidKNNRegressor : FluidModelObject {
|
||||||
|
|
||||||
var <>numNeighbours, <>weight;
|
var <>numNeighbours, <>weight;
|
||||||
|
|
||||||
*new {|server, numNeighbours = 3, weight = 1|
|
*new {|server, numNeighbours = 3, weight = 1|
|
||||||
^super.new(server,[numNeighbours,weight])
|
^super.new(server,[numNeighbours,weight])
|
||||||
.numNeighbours_(numNeighbours)
|
.numNeighbours_(numNeighbours)
|
||||||
.weight_(weight);
|
.weight_(weight);
|
||||||
}
|
}
|
||||||
|
|
||||||
prGetParams{^[this.id,this.numNeighbours,this.weight,-1,-1];}
|
prGetParams{^[this.id,this.numNeighbours,this.weight,-1,-1];}
|
||||||
|
|
||||||
fitMsg{|sourceDataSet, targetDataSet|
|
fitMsg{|sourceDataSet, targetDataSet|
|
||||||
^this.prMakeMsg(\fit,this.id,sourceDataSet.id,targetDataSet.id)
|
^this.prMakeMsg(\fit,this.id,sourceDataSet.id,targetDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|sourceDataSet, targetDataSet, action|
|
fit{|sourceDataSet, targetDataSet, action|
|
||||||
actions[\fit] = [nil,action];
|
actions[\fit] = [nil,action];
|
||||||
this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet));
|
this.prSendMsg(this.fitMsg(sourceDataSet, targetDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
predictMsg{ |sourceDataSet, targetDataSet|
|
predictMsg{ |sourceDataSet, targetDataSet|
|
||||||
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
|
^this.prMakeMsg(\predict,this.id,sourceDataSet.id,targetDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
predict{ |sourceDataSet, targetDataSet,action|
|
predict{ |sourceDataSet, targetDataSet,action|
|
||||||
actions[\predict] = [nil, action];
|
actions[\predict] = [nil, action];
|
||||||
this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
|
this.prSendMsg(this.predictMsg(sourceDataSet, targetDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPointMsg { |buffer|
|
predictPointMsg { |buffer|
|
||||||
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer));
|
^this.prMakeMsg(\predictPoint,id, this.prEncodeBuffer(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
predictPoint { |buffer, action|
|
predictPoint { |buffer, action|
|
||||||
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
actions[\predictPoint] = [number(FluidMessageResponse,_,_),action];
|
||||||
this.prSendMsg(this.predictPointMsg(buffer));
|
this.prSendMsg(this.predictPointMsg(buffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
kr{|trig, inputBuffer,outputBuffer|
|
kr{|trig, inputBuffer,outputBuffer|
|
||||||
^FluidKNNRegressorQuery.kr(K2A.ar(trig),
|
^FluidKNNRegressorQuery.kr(K2A.ar(trig),
|
||||||
this, this.numNeighbours, this.weight,
|
this, this.numNeighbours, this.weight,
|
||||||
this.prEncodeBuffer(inputBuffer),
|
this.prEncodeBuffer(inputBuffer),
|
||||||
this.prEncodeBuffer(outputBuffer));
|
this.prEncodeBuffer(outputBuffer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidKNNRegressorQuery : FluidRTMultiOutUGen {
|
FluidKNNRegressorQuery : FluidRTMultiOutUGen {
|
||||||
|
|
||||||
*kr{ |trig, model,numNeighbours = 3, weight = 1,inputBuffer, outputBuffer |
|
*kr{ |trig, model,numNeighbours = 3, weight = 1,inputBuffer, outputBuffer |
|
||||||
^this.multiNew('control',trig, model.asUGenInput,
|
^this.multiNew('control',trig, model.asUGenInput,
|
||||||
numNeighbours,weight,
|
numNeighbours,weight,
|
||||||
inputBuffer.asUGenInput, outputBuffer.asUGenInput)
|
inputBuffer.asUGenInput, outputBuffer.asUGenInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
init { arg ... theInputs;
|
init { arg ... theInputs;
|
||||||
inputs = theInputs;
|
inputs = theInputs;
|
||||||
^this.initOutputs(1, rate);
|
^this.initOutputs(1, rate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,43 +1,43 @@
|
|||||||
FluidLoudness : FluidRTMultiOutUGen {
|
FluidLoudness : FluidRTMultiOutUGen {
|
||||||
|
|
||||||
const <features=#[\loudness, \peak];
|
const <features=#[\loudness, \peak];
|
||||||
classvar featuresLookup;
|
classvar featuresLookup;
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
||||||
}
|
}
|
||||||
|
|
||||||
*prWarnUnrecognised {|sym| ("WARNING: FluidLoudness -" + sym + "is not a recognised option").postln}
|
*prWarnUnrecognised {|sym| ("WARNING: FluidLoudness -" + sym + "is not a recognised option").postln}
|
||||||
|
|
||||||
*prProcessSelect {|a|
|
*prProcessSelect {|a|
|
||||||
var bits;
|
var bits;
|
||||||
a.asBag.countsDo{|item,count,i|
|
a.asBag.countsDo{|item,count,i|
|
||||||
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
||||||
};
|
};
|
||||||
bits = a.collect{ |sym|
|
bits = a.collect{ |sym|
|
||||||
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
||||||
}.reduce{|x,y| x | y};
|
}.reduce{|x,y| x | y};
|
||||||
^bits
|
^bits
|
||||||
}
|
}
|
||||||
|
|
||||||
*kr { arg in = 0, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, maxWindowSize = 16384;
|
*kr { arg in = 0, select, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, maxWindowSize = 16384;
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
^this.multiNew('control', in.asAudioRateInput(this), selectbits, kWeighting, truePeak, windowSize, hopSize, maxWindowSize);
|
^this.multiNew('control', in.asAudioRateInput(this), selectbits, kWeighting, truePeak, windowSize, hopSize, maxWindowSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
init {arg ...theInputs;
|
init {arg ...theInputs;
|
||||||
var numChannels;
|
var numChannels;
|
||||||
inputs = theInputs;
|
inputs = theInputs;
|
||||||
numChannels = inputs.at(1).asBinaryDigits.sum;
|
numChannels = inputs.at(1).asBinaryDigits.sum;
|
||||||
^this.initOutputs(numChannels,rate);
|
^this.initOutputs(numChannels,rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInputs {
|
checkInputs {
|
||||||
if(inputs.at(6).rate != 'scalar') {
|
if(inputs.at(6).rate != 'scalar') {
|
||||||
^(": maxwindowSize cannot be modulated.");
|
^(": maxwindowSize cannot be modulated.");
|
||||||
};
|
};
|
||||||
^this.checkValidInputs;
|
^this.checkValidInputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +1,41 @@
|
|||||||
FluidMessageResponse : Object
|
FluidMessageResponse : Object
|
||||||
{
|
{
|
||||||
//selectors is an array of functions
|
//selectors is an array of functions
|
||||||
//my cunning thought is that those that need extra data (e..g numbers()) can
|
//my cunning thought is that those that need extra data (e..g numbers()) can
|
||||||
//use partial applicaiton
|
//use partial applicaiton
|
||||||
*collectArgs{ |selectors,a|
|
*collectArgs{ |selectors,a|
|
||||||
var response = [];
|
var response = [];
|
||||||
var idx = 0;
|
var idx = 0;
|
||||||
selectors.do{ |selector|
|
selectors.do{ |selector|
|
||||||
var newThings;
|
var newThings;
|
||||||
# newThings,idx = selector.value(a, idx);
|
# newThings,idx = selector.value(a, idx);
|
||||||
response = response ++ newThings;
|
response = response ++ newThings;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(response.size == 1,
|
if(response.size == 1,
|
||||||
{^response[0]},{^response})
|
{^response[0]},{^response})
|
||||||
}
|
}
|
||||||
|
|
||||||
*string{ |a, offset|
|
*string{ |a, offset|
|
||||||
^[a]
|
^[a]
|
||||||
}
|
}
|
||||||
|
|
||||||
*strings {|a,offset|
|
*strings {|a,offset|
|
||||||
//TODO add an n argument as with numbers() to make this less omnivorous
|
//TODO add an n argument as with numbers() to make this less omnivorous
|
||||||
^[a.drop(offset)];
|
^[a.drop(offset)];
|
||||||
}
|
}
|
||||||
|
|
||||||
*numbers{ |a, n, offset|
|
*numbers{ |a, n, offset|
|
||||||
n = n ? a.size - offset; //send n = nil to consume everything
|
n = n ? a.size - offset; //send n = nil to consume everything
|
||||||
^[a.copyRange(offset, offset + n),offset + n]
|
^[a.copyRange(offset, offset + n),offset + n]
|
||||||
}
|
}
|
||||||
|
|
||||||
*number{ |a,offset|
|
*number{ |a,offset|
|
||||||
^[a[offset]];
|
^[a[offset]];
|
||||||
}
|
}
|
||||||
|
|
||||||
*buffer{ |a,server,offset|
|
*buffer{ |a,server,offset|
|
||||||
server = server ? Server.default ;
|
server = server ? Server.default ;
|
||||||
^[Buffer.cachedBufferAt(server, a[offset]), offset + 1]
|
^[Buffer.cachedBufferAt(server, a[offset]), offset + 1]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,103 +1,103 @@
|
|||||||
FluidNormalize : FluidModelObject {
|
FluidNormalize : FluidModelObject {
|
||||||
|
|
||||||
var <>min, <>max;
|
var <>min, <>max;
|
||||||
|
|
||||||
*new {|server, min = 0, max = 1|
|
*new {|server, min = 0, max = 1|
|
||||||
^super.new(server,[min,max])
|
^super.new(server,[min,max])
|
||||||
.min_(min).max_(max);
|
.min_(min).max_(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
prGetParams{
|
prGetParams{
|
||||||
^[this.id, this.min,this.max,-1,-1];
|
^[this.id, this.min,this.max,-1,-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fitMsg{|dataSet|
|
fitMsg{|dataSet|
|
||||||
^this.prMakeMsg(\fit,id,dataSet.id)
|
^this.prMakeMsg(\fit,id,dataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fit{|dataSet, action|
|
fit{|dataSet, action|
|
||||||
actions[\fit] = [nil,action];
|
actions[\fit] = [nil,action];
|
||||||
this.prSendMsg(this.fitMsg(dataSet));
|
this.prSendMsg(this.fitMsg(dataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
transformMsg{|sourceDataSet, destDataSet|
|
transformMsg{|sourceDataSet, destDataSet|
|
||||||
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
^this.prMakeMsg(\transform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
transform{|sourceDataSet, destDataSet, action|
|
transform{|sourceDataSet, destDataSet, action|
|
||||||
actions[\transform] = [nil,action];
|
actions[\transform] = [nil,action];
|
||||||
this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet));
|
this.prSendMsg(this.transformMsg(sourceDataSet, destDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
fitTransformMsg{|sourceDataSet, destDataSet|
|
fitTransformMsg{|sourceDataSet, destDataSet|
|
||||||
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
^this.prMakeMsg(\fitTransform,id,sourceDataSet.id,destDataSet.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fitTransform{|sourceDataSet, destDataSet, action|
|
fitTransform{|sourceDataSet, destDataSet, action|
|
||||||
actions[\fitTransform] = [nil,action];
|
actions[\fitTransform] = [nil,action];
|
||||||
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
this.prSendMsg(this.fitTransformMsg(sourceDataSet, destDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
transformPointMsg{|sourceBuffer, destBuffer|
|
transformPointMsg{|sourceBuffer, destBuffer|
|
||||||
^this.prMakeMsg(\transformPoint,id,
|
^this.prMakeMsg(\transformPoint,id,
|
||||||
this.prEncodeBuffer(sourceBuffer),
|
this.prEncodeBuffer(sourceBuffer),
|
||||||
this.prEncodeBuffer(destBuffer),
|
this.prEncodeBuffer(destBuffer),
|
||||||
["/b_query",destBuffer.asUGenInput]
|
["/b_query",destBuffer.asUGenInput]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
transformPoint{|sourceBuffer, destBuffer, action|
|
transformPoint{|sourceBuffer, destBuffer, action|
|
||||||
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
actions[\transformPoint] = [nil,{action.value(destBuffer)}];
|
||||||
this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer));
|
this.prSendMsg(this.transformPointMsg(sourceBuffer, destBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
inverseTransformMsg{|sourceDataSet, destDataSet|
|
inverseTransformMsg{|sourceDataSet, destDataSet|
|
||||||
^this.prMakeMsg(\inverseTransform,id,sourceDataSet.id,destDataSet.id);
|
^this.prMakeMsg(\inverseTransform,id,sourceDataSet.id,destDataSet.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
inverseTransform{|sourceDataSet, destDataSet, action|
|
inverseTransform{|sourceDataSet, destDataSet, action|
|
||||||
actions[\inverseTransform] = [nil,action];
|
actions[\inverseTransform] = [nil,action];
|
||||||
this.prSendMsg(this.inverseTransformMsg(sourceDataSet, destDataSet));
|
this.prSendMsg(this.inverseTransformMsg(sourceDataSet, destDataSet));
|
||||||
}
|
}
|
||||||
|
|
||||||
inverseTransformPointMsg{|sourceBuffer, destBuffer|
|
inverseTransformPointMsg{|sourceBuffer, destBuffer|
|
||||||
^this.prMakeMsg(\inverseTransformPoint,id,
|
^this.prMakeMsg(\inverseTransformPoint,id,
|
||||||
this.prEncodeBuffer(sourceBuffer),
|
this.prEncodeBuffer(sourceBuffer),
|
||||||
this.prEncodeBuffer(destBuffer),
|
this.prEncodeBuffer(destBuffer),
|
||||||
["/b_query",destBuffer.asUGenInput]
|
["/b_query",destBuffer.asUGenInput]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
inverseTransformPoint{|sourceBuffer, destBuffer, action|
|
inverseTransformPoint{|sourceBuffer, destBuffer, action|
|
||||||
actions[\inverseTransformPoint] = [nil,{action.value(destBuffer)}];
|
actions[\inverseTransformPoint] = [nil,{action.value(destBuffer)}];
|
||||||
this.prSendMsg(this.inverseTransformPointMsg(sourceBuffer, destBuffer));
|
this.prSendMsg(this.inverseTransformPointMsg(sourceBuffer, destBuffer));
|
||||||
}
|
}
|
||||||
|
|
||||||
kr{|trig, inputBuffer,outputBuffer,min = 0 ,max = 1,invert = 0|
|
kr{|trig, inputBuffer,outputBuffer,min = 0 ,max = 1,invert = 0|
|
||||||
|
|
||||||
min = min ? this.min;
|
min = min ? this.min;
|
||||||
max = max ? this.max;
|
max = max ? this.max;
|
||||||
|
|
||||||
this.min_(min).max_(max);
|
this.min_(min).max_(max);
|
||||||
|
|
||||||
^FluidNormalizeQuery.kr(trig,
|
^FluidNormalizeQuery.kr(trig,
|
||||||
this, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer), this.min, this.max, invert);
|
this, this.prEncodeBuffer(inputBuffer), this.prEncodeBuffer(outputBuffer), this.min, this.max, invert);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidNormalizeQuery : FluidRTMultiOutUGen {
|
FluidNormalizeQuery : FluidRTMultiOutUGen {
|
||||||
|
|
||||||
*kr{ |trig, model,inputBuffer,outputBuffer,min = 0 ,max = 1,invert = 0|
|
*kr{ |trig, model,inputBuffer,outputBuffer,min = 0 ,max = 1,invert = 0|
|
||||||
// inputBuffer.asUGenInput.postln;
|
// inputBuffer.asUGenInput.postln;
|
||||||
^this.multiNew('control',trig, model.asUGenInput,
|
^this.multiNew('control',trig, model.asUGenInput,
|
||||||
min,max,invert,
|
min,max,invert,
|
||||||
inputBuffer.asUGenInput, outputBuffer.asUGenInput)
|
inputBuffer.asUGenInput, outputBuffer.asUGenInput)
|
||||||
}
|
}
|
||||||
|
|
||||||
init { arg ... theInputs;
|
init { arg ... theInputs;
|
||||||
inputs = theInputs;
|
inputs = theInputs;
|
||||||
^this.initOutputs(1, rate);
|
^this.initOutputs(1, rate);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,44 +1,44 @@
|
|||||||
FluidPitch : FluidRTMultiOutUGen {
|
FluidPitch : FluidRTMultiOutUGen {
|
||||||
|
|
||||||
const <features=#[\pitch, \confidence];
|
const <features=#[\pitch, \confidence];
|
||||||
classvar featuresLookup;
|
classvar featuresLookup;
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
||||||
}
|
}
|
||||||
|
|
||||||
*prWarnUnrecognised {|sym| ("WARNING: FluidPitch -" + sym + "is not a recognised option").postln}
|
|
||||||
|
|
||||||
*prProcessSelect {|a|
|
*prWarnUnrecognised {|sym| ("WARNING: FluidPitch -" + sym + "is not a recognised option").postln}
|
||||||
var bits;
|
|
||||||
a.asBag.countsDo{|item,count,i|
|
*prProcessSelect {|a|
|
||||||
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
var bits;
|
||||||
};
|
a.asBag.countsDo{|item,count,i|
|
||||||
bits = a.collect{ |sym|
|
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
||||||
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
};
|
||||||
}.reduce{|x,y| x | y};
|
bits = a.collect{ |sym|
|
||||||
^bits
|
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
||||||
}
|
}.reduce{|x,y| x | y};
|
||||||
|
^bits
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
*kr { arg in = 0, select, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = -1;
|
*kr { arg in = 0, select, algorithm = 2, minFreq = 20, maxFreq = 10000, unit = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = -1;
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
^this.multiNew('control', in.asAudioRateInput(this), selectbits, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize);
|
^this.multiNew('control', in.asAudioRateInput(this), selectbits, algorithm, minFreq, maxFreq, unit, windowSize, hopSize, fftSize, maxFFTSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
init {arg ...theInputs;
|
init {arg ...theInputs;
|
||||||
var numChannels;
|
var numChannels;
|
||||||
inputs = theInputs;
|
inputs = theInputs;
|
||||||
numChannels = inputs.at(1).asBinaryDigits.sum;
|
numChannels = inputs.at(1).asBinaryDigits.sum;
|
||||||
^this.initOutputs(numChannels,rate);
|
^this.initOutputs(numChannels,rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInputs {
|
checkInputs {
|
||||||
if(inputs.at(9).rate != 'scalar') {
|
if(inputs.at(9).rate != 'scalar') {
|
||||||
^(": maxFFTSize cannot be modulated.");
|
^(": maxFFTSize cannot be modulated.");
|
||||||
};
|
};
|
||||||
^this.checkValidInputs;
|
^this.checkValidInputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,346 +1,346 @@
|
|||||||
FluidServerObject
|
FluidServerObject
|
||||||
{
|
{
|
||||||
classvar serverCaches;
|
classvar serverCaches;
|
||||||
classvar count;
|
classvar count;
|
||||||
classvar persistent = true;
|
classvar persistent = true;
|
||||||
var <server,<id;
|
var <server,<id;
|
||||||
|
|
||||||
*version{|server|
|
*version{|server|
|
||||||
server ?? {server = Server.default};
|
server ?? {server = Server.default};
|
||||||
server.sendMsg("/cmd","/"++this.objectClassName++'/version');
|
server.sendMsg("/cmd","/"++this.objectClassName++'/version');
|
||||||
}
|
}
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
serverCaches = IdentityDictionary.new;
|
serverCaches = IdentityDictionary.new;
|
||||||
count = 0;
|
count = 0;
|
||||||
ServerBoot.add({serverCaches[this]!?{serverCaches[this].cache.put(Server.internal,nil);}},Server.internal);
|
ServerBoot.add({serverCaches[this]!?{serverCaches[this].cache.put(Server.internal,nil);}},Server.internal);
|
||||||
}
|
}
|
||||||
|
|
||||||
*initCache {|server|
|
*initCache {|server|
|
||||||
serverCaches[this] ?? { serverCaches[this] = FluidServerCache.new};
|
serverCaches[this] ?? { serverCaches[this] = FluidServerCache.new};
|
||||||
|
|
||||||
if(server === Server.internal and: serverCaches[this].cache[Server.internal].isNil)
|
if(server === Server.internal and: serverCaches[this].cache[Server.internal].isNil)
|
||||||
{
|
{
|
||||||
this.flush(Server.internal)
|
this.flush(Server.internal)
|
||||||
};
|
};
|
||||||
|
|
||||||
serverCaches[this].initCache(server);
|
serverCaches[this].initCache(server);
|
||||||
NotificationCenter.register(server,\newAllocators,this,{ count = 0; });
|
NotificationCenter.register(server,\newAllocators,this,{ count = 0; });
|
||||||
}
|
}
|
||||||
|
|
||||||
*newMsg{|id, params|
|
*newMsg{|id, params|
|
||||||
params = params !? {params.collect(_.asUGenInput)};
|
params = params !? {params.collect(_.asUGenInput)};
|
||||||
^this.prMakeMsg(\new,id,*params);
|
^this.prMakeMsg(\new,id,*params);
|
||||||
}
|
}
|
||||||
|
|
||||||
*new{ |server, id, params, action, callNew = true|
|
*new{ |server, id, params, action, callNew = true|
|
||||||
var newObj;
|
var newObj;
|
||||||
server ?? {server = Server.default};
|
server ?? {server = Server.default};
|
||||||
if(server.serverRunning.not){"Server not running".warn};
|
if(server.serverRunning.not){"Server not running".warn};
|
||||||
id !? { id = id.asInteger }
|
id !? { id = id.asInteger }
|
||||||
?? { id = count; count = count + 1; };
|
?? { id = count; count = count + 1; };
|
||||||
newObj = super.newCopyArgs(server,id,action);
|
newObj = super.newCopyArgs(server,id,action);
|
||||||
// params.postln;
|
// params.postln;
|
||||||
if(callNew) {server.listSendMsg(this.newMsg(id,params))};
|
if(callNew) {server.listSendMsg(this.newMsg(id,params))};
|
||||||
^newObj.cache
|
^newObj.cache
|
||||||
}
|
}
|
||||||
|
|
||||||
cache {
|
cache {
|
||||||
this.class.initCache(server);
|
this.class.initCache(server);
|
||||||
serverCaches[this.class].put(server,this.id,this);
|
serverCaches[this.class].put(server,this.id,this);
|
||||||
}
|
}
|
||||||
|
|
||||||
uncache{
|
uncache{
|
||||||
serverCaches[this.class].remove(server,id);
|
serverCaches[this.class].remove(server,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
*prMakeMsg{|msg,id...args|
|
*prMakeMsg{|msg,id...args|
|
||||||
var commandName = "%/%".format(this.objectClassName,msg);
|
var commandName = "%/%".format(this.objectClassName,msg);
|
||||||
^['/cmd', this.objectClassName,commandName,id].addAll(args);
|
^['/cmd', this.objectClassName,commandName,id].addAll(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
prMakeMsg{|msg,id...args| ^this.class.prMakeMsg(msg,id,*args) }
|
prMakeMsg{|msg,id...args| ^this.class.prMakeMsg(msg,id,*args) }
|
||||||
|
|
||||||
freeMsg {
|
freeMsg {
|
||||||
var msg;
|
var msg;
|
||||||
id ?? {" % already freed".format(this.class.name).warn; ^nil};
|
id ?? {" % already freed".format(this.class.name).warn; ^nil};
|
||||||
this.uncache;
|
this.uncache;
|
||||||
msg = this.prMakeMsg(\free,id);
|
msg = this.prMakeMsg(\free,id);
|
||||||
id = nil;
|
id = nil;
|
||||||
^msg;
|
^msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
free{
|
free{
|
||||||
var msg = this.freeMsg;
|
var msg = this.freeMsg;
|
||||||
msg !? {server.listSendMsg(msg)} ?? {^nil};
|
msg !? {server.listSendMsg(msg)} ?? {^nil};
|
||||||
}
|
}
|
||||||
|
|
||||||
*freeAll{|server|
|
*freeAll{|server|
|
||||||
serverCaches[this] !? {|cache|
|
serverCaches[this] !? {|cache|
|
||||||
cache.clearCache(server ? Server.default);
|
cache.clearCache(server ? Server.default);
|
||||||
};
|
};
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
asUGenInput{ ^id }
|
asUGenInput{ ^id }
|
||||||
|
|
||||||
asString {
|
asString {
|
||||||
^"%(%)".format(this.class.name,id).asString;
|
^"%(%)".format(this.class.name,id).asString;
|
||||||
}
|
}
|
||||||
|
|
||||||
asSymbol {
|
asSymbol {
|
||||||
^id.asSymbol
|
^id.asSymbol
|
||||||
}
|
}
|
||||||
|
|
||||||
*objectClassName { ^this.name.asSymbol }
|
*objectClassName { ^this.name.asSymbol }
|
||||||
|
|
||||||
*flushMsg { ^['/cmd',this.objectClassName ++ '/flush'] }
|
*flushMsg { ^['/cmd',this.objectClassName ++ '/flush'] }
|
||||||
|
|
||||||
*flush {|server| server.listSendMsg(this.flushMsg)}
|
*flush {|server| server.listSendMsg(this.flushMsg)}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidBufProcessor : FluidServerObject
|
FluidBufProcessor : FluidServerObject
|
||||||
{
|
{
|
||||||
var <processAction;
|
var <processAction;
|
||||||
var <outputBuffers;
|
var <outputBuffers;
|
||||||
var <freeWhenDone;
|
var <freeWhenDone;
|
||||||
classvar responder;
|
classvar responder;
|
||||||
classvar count;
|
classvar count;
|
||||||
|
|
||||||
*cmdPeriod {
|
*cmdPeriod {
|
||||||
serverCaches[this] !? {|cache|
|
serverCaches[this] !? {|cache|
|
||||||
cache.doAll{|processor| processor !? { processor.free;} };
|
cache.doAll{|processor| processor !? { processor.free;} };
|
||||||
serverCaches[this] = nil;
|
serverCaches[this] = nil;
|
||||||
};
|
};
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
*initCache {|server|
|
*initCache {|server|
|
||||||
// "initcache".postln;
|
// "initcache".postln;
|
||||||
// this.done.postln;
|
// this.done.postln;
|
||||||
super.initCache(server);
|
super.initCache(server);
|
||||||
CmdPeriod.add(this);
|
CmdPeriod.add(this);
|
||||||
if(serverCaches[this].includesKey(server,\processResponder).not)
|
if(serverCaches[this].includesKey(server,\processResponder).not)
|
||||||
{
|
{
|
||||||
serverCaches[this].put(server,\processResponder,OSCFunc({|m|
|
serverCaches[this].put(server,\processResponder,OSCFunc({|m|
|
||||||
var id = m.last.asInteger;
|
var id = m.last.asInteger;
|
||||||
// "I'm in the pizza hut".postln;
|
// "I'm in the pizza hut".postln;
|
||||||
serverCaches[this].at(server,id) !? {|p|
|
serverCaches[this].at(server,id) !? {|p|
|
||||||
// "I'm in the taco bell".postln ;
|
// "I'm in the taco bell".postln ;
|
||||||
p!?{
|
p!?{
|
||||||
p.processAction!?{|a|
|
p.processAction!?{|a|
|
||||||
var bufs = p.outputBuffers;
|
var bufs = p.outputBuffers;
|
||||||
|
|
||||||
bufs = bufs.collect{|b|
|
bufs = bufs.collect{|b|
|
||||||
if(b.isKindOf(Buffer))
|
if(b.isKindOf(Buffer))
|
||||||
{b}
|
{b}
|
||||||
{Buffer.cachedBufferAt(server,b)};
|
{Buffer.cachedBufferAt(server,b)};
|
||||||
};
|
};
|
||||||
a.valueArray(valueArray(bufs));
|
a.valueArray(valueArray(bufs));
|
||||||
};
|
};
|
||||||
if(p.freeWhenDone){p.free};
|
if(p.freeWhenDone){p.free};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},this.done ,server.addr).fix)
|
},this.done ,server.addr).fix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*new {|server,id,outputBuffers|
|
*new {|server,id,outputBuffers|
|
||||||
^super.new(server,id, nil, nil,false).init(outputBuffers);
|
^super.new(server,id, nil, nil,false).init(outputBuffers);
|
||||||
}
|
}
|
||||||
|
|
||||||
init{ |ob|
|
init{ |ob|
|
||||||
outputBuffers = ob;
|
outputBuffers = ob;
|
||||||
}
|
}
|
||||||
|
|
||||||
*done {
|
*done {
|
||||||
^"/%/process".format(this.objectClassName);
|
^"/%/process".format(this.objectClassName);
|
||||||
}
|
}
|
||||||
|
|
||||||
wait {
|
wait {
|
||||||
var condition = Condition.new;
|
var condition = Condition.new;
|
||||||
id ?? {Error("% already freed".format(this.class.name)).throw};
|
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||||
OSCFunc({
|
OSCFunc({
|
||||||
condition.unhang;
|
condition.unhang;
|
||||||
},this.class.done,server.addr,argTemplate:[nil,id]).oneShot;
|
},this.class.done,server.addr,argTemplate:[nil,id]).oneShot;
|
||||||
condition.hang;
|
condition.hang;
|
||||||
}
|
}
|
||||||
|
|
||||||
processMsg {|params|
|
processMsg {|params|
|
||||||
var msg;
|
var msg;
|
||||||
var completionMsg = outputBuffers !? {
|
var completionMsg = outputBuffers !? {
|
||||||
[["/sync"]] ++ outputBuffers.collect{|b| ["/b_query", b.asUGenInput]}
|
[["/sync"]] ++ outputBuffers.collect{|b| ["/b_query", b.asUGenInput]}
|
||||||
} ?? {[]};
|
} ?? {[]};
|
||||||
|
|
||||||
// completionMsg.postln;
|
// completionMsg.postln;
|
||||||
id ?? {Error("% already freed".format(this.class.name)).throw};
|
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||||
msg = this.prMakeMsg(\processNew,id).addAll(params).add(completionMsg);
|
msg = this.prMakeMsg(\processNew,id).addAll(params).add(completionMsg);
|
||||||
// msg.postln;
|
// msg.postln;
|
||||||
^msg;
|
^msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
processList { |params,shouldFree,action|
|
processList { |params,shouldFree,action|
|
||||||
freeWhenDone = shouldFree;
|
freeWhenDone = shouldFree;
|
||||||
processAction = action;
|
processAction = action;
|
||||||
params = params.collect(_.asUGenInput);
|
params = params.collect(_.asUGenInput);
|
||||||
server.listSendMsg(this.processMsg(params));
|
server.listSendMsg(this.processMsg(params));
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelMsg{
|
cancelMsg{
|
||||||
id ?? {Error("% already freed".format(this.class.name)).throw};
|
id ?? {Error("% already freed".format(this.class.name)).throw};
|
||||||
^this.prMakeMsg(\cancel, id);
|
^this.prMakeMsg(\cancel, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel{
|
cancel{
|
||||||
server.listSendMsg(this.cancelMsg);
|
server.listSendMsg(this.cancelMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
kr{ ^FluidProxyUgen.kr(this.class.objectClassName ++ "Monitor",id) }
|
kr{ ^FluidProxyUgen.kr(this.class.objectClassName ++ "Monitor",id) }
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidOSCPatternInversion : OSCMessageDispatcher
|
FluidOSCPatternInversion : OSCMessageDispatcher
|
||||||
{
|
{
|
||||||
value {|msg, time, addr, recvPort|
|
value {|msg, time, addr, recvPort|
|
||||||
var msgpath = msg[0].asSymbol;
|
var msgpath = msg[0].asSymbol;
|
||||||
active.keysValuesDo({|key, func|
|
active.keysValuesDo({|key, func|
|
||||||
if(msgpath.matchOSCAddressPattern(key), {func.value(msg, time, addr, recvPort);});
|
if(msgpath.matchOSCAddressPattern(key), {func.value(msg, time, addr, recvPort);});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluidDataObject : FluidServerObject
|
FluidDataObject : FluidServerObject
|
||||||
{
|
{
|
||||||
classvar postResponse;
|
classvar postResponse;
|
||||||
|
|
||||||
var <actions;
|
var <actions;
|
||||||
|
|
||||||
*initClass{
|
*initClass{
|
||||||
postResponse = _.postln;
|
postResponse = _.postln;
|
||||||
}
|
}
|
||||||
|
|
||||||
*initCache{ |server|
|
*initCache{ |server|
|
||||||
super.initCache(server);
|
super.initCache(server);
|
||||||
if(serverCaches[this].includesKey(server,\messageResponder).not)
|
if(serverCaches[this].includesKey(server,\messageResponder).not)
|
||||||
{
|
{
|
||||||
serverCaches[this].put(server,\messageResponder,OSCFunc.new({|m|
|
serverCaches[this].put(server,\messageResponder,OSCFunc.new({|m|
|
||||||
var id = m[1].asInteger;
|
var id = m[1].asInteger;
|
||||||
var method;
|
var method;
|
||||||
serverCaches[this].at(server,id) !? { |p|
|
serverCaches[this].at(server,id) !? { |p|
|
||||||
method = m[0].asString.findRegexp("/"++this.name++"/(.*)")[1][1].asSymbol;
|
method = m[0].asString.findRegexp("/"++this.name++"/(.*)")[1][1].asSymbol;
|
||||||
p.actions[method] !? {|a|
|
p.actions[method] !? {|a|
|
||||||
//two items: parser and action
|
//two items: parser and action
|
||||||
var parser = a[0];
|
var parser = a[0];
|
||||||
var action = a[1];
|
var action = a[1];
|
||||||
var result = FluidMessageResponse.collectArgs(parser,m[2..]);
|
var result = FluidMessageResponse.collectArgs(parser,m[2..]);
|
||||||
action.value(result);
|
action.value(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},'/' ++ this.objectClassName ++ '/*',server.addr, dispatcher:FluidOSCPatternInversion.new).fix)
|
},'/' ++ this.objectClassName ++ '/*',server.addr, dispatcher:FluidOSCPatternInversion.new).fix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*new{|server...args|
|
*new{|server...args|
|
||||||
// args.flatten.postln;
|
// args.flatten.postln;
|
||||||
^super.new(server,params:args.flatten).init;
|
^super.new(server,params:args.flatten).init;
|
||||||
}
|
}
|
||||||
|
|
||||||
*cachedInstanceAt{|server,id|
|
*cachedInstanceAt{|server,id|
|
||||||
this.initCache(server);
|
this.initCache(server);
|
||||||
^serverCaches[this].at(server,id);
|
^serverCaches[this].at(server,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
actions = IdentityDictionary.new;
|
actions = IdentityDictionary.new;
|
||||||
}
|
}
|
||||||
|
|
||||||
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
|
prEncodeBuffer { |buf| buf !? {^buf.asUGenInput} ?? {^-1} }
|
||||||
|
|
||||||
prSendMsg {|msg| server !? {server.listSendMsg(msg)};}
|
prSendMsg {|msg| server !? {server.listSendMsg(msg)};}
|
||||||
|
|
||||||
colsMsg { ^this.prMakeMsg(\cols,id);}
|
colsMsg { ^this.prMakeMsg(\cols,id);}
|
||||||
|
|
||||||
cols{ |action=(postResponse)|
|
cols{ |action=(postResponse)|
|
||||||
actions[\cols] = [numbers(FluidMessageResponse,_,1,_),action];
|
actions[\cols] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
this.prSendMsg(this.colsMsg)
|
this.prSendMsg(this.colsMsg)
|
||||||
}
|
}
|
||||||
|
|
||||||
readMsg { |filename| ^this.prMakeMsg(\read,id,filename.asString);}
|
readMsg { |filename| ^this.prMakeMsg(\read,id,filename.asString);}
|
||||||
|
|
||||||
read{|filename, action|
|
read{|filename, action|
|
||||||
actions[\read] = [nil,action];
|
actions[\read] = [nil,action];
|
||||||
this.prSendMsg(this.readMsg(filename));
|
this.prSendMsg(this.readMsg(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
writeMsg {|filename|
|
writeMsg {|filename|
|
||||||
// ^['/cmd',this.class.name ++ '/write',id,filename.asString]
|
// ^['/cmd',this.class.name ++ '/write',id,filename.asString]
|
||||||
^this.prMakeMsg(\write,id,filename.asString);
|
^this.prMakeMsg(\write,id,filename.asString);
|
||||||
}
|
}
|
||||||
|
|
||||||
write{|filename, action|
|
write{|filename, action|
|
||||||
actions[\write] = [nil,action];
|
actions[\write] = [nil,action];
|
||||||
this.prSendMsg(this.writeMsg(filename));
|
this.prSendMsg(this.writeMsg(filename));
|
||||||
}
|
}
|
||||||
|
|
||||||
sizeMsg{
|
sizeMsg{
|
||||||
// ^['/cmd',this.class.name ++ '/size',id]
|
// ^['/cmd',this.class.name ++ '/size',id]
|
||||||
^this.prMakeMsg(\size,id);
|
^this.prMakeMsg(\size,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
size {|action=(postResponse)|
|
size {|action=(postResponse)|
|
||||||
actions[\size] = [numbers(FluidMessageResponse,_,1,_),action];
|
actions[\size] = [numbers(FluidMessageResponse,_,1,_),action];
|
||||||
this.prSendMsg(this.sizeMsg);
|
this.prSendMsg(this.sizeMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidModelObject : FluidDataObject
|
FluidModelObject : FluidDataObject
|
||||||
{
|
{
|
||||||
prGetParams{
|
prGetParams{
|
||||||
"Subclass should provide this".throw;
|
"Subclass should provide this".throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
prUpdateStateMsg{
|
prUpdateStateMsg{
|
||||||
var params = this.prGetParams.value.collect(_.asUGenInput);
|
var params = this.prGetParams.value.collect(_.asUGenInput);
|
||||||
^this.prMakeMsg(\setParams,id) ++ params;
|
^this.prMakeMsg(\setParams,id) ++ params;
|
||||||
}
|
}
|
||||||
|
|
||||||
prSendMsg {|msg|
|
prSendMsg {|msg|
|
||||||
//These need to happen sequentially, but not simultaneously
|
//These need to happen sequentially, but not simultaneously
|
||||||
//sending as a bundle makes reasoning about timing w/r/t other
|
//sending as a bundle makes reasoning about timing w/r/t other
|
||||||
//commands more awkward, unless we set the offet to 0 (in which case,
|
//commands more awkward, unless we set the offet to 0 (in which case,
|
||||||
//noisy 'late' messages)
|
//noisy 'late' messages)
|
||||||
super.prSendMsg(this.prUpdateStateMsg);
|
super.prSendMsg(this.prUpdateStateMsg);
|
||||||
super.prSendMsg(msg);
|
super.prSendMsg(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidRealTimeModel : FluidModelObject
|
FluidRealTimeModel : FluidModelObject
|
||||||
{
|
{
|
||||||
*new{ |server, params|
|
*new{ |server, params|
|
||||||
^super.new(server,params++[-1,-1]);
|
^super.new(server,params++[-1,-1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidRTQuery : FluidProxyUgen
|
FluidRTQuery : FluidProxyUgen
|
||||||
{
|
{
|
||||||
*kr{ |trig,obj...args|
|
*kr{ |trig,obj...args|
|
||||||
^super.kr(this.name,trig,obj.asUGenInput, *args)
|
^super.kr(this.name,trig,obj.asUGenInput, *args)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FluidRTUGen : UGen
|
FluidRTUGen : UGen
|
||||||
{
|
{
|
||||||
*version{|server|
|
*version{|server|
|
||||||
server ?? {server = Server.default};
|
server ?? {server = Server.default};
|
||||||
server.sendMsg("/cmd","/"++this.name++'/version');
|
server.sendMsg("/cmd","/"++this.name++'/version');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluidRTMultiOutUGen : MultiOutUGen
|
FluidRTMultiOutUGen : MultiOutUGen
|
||||||
{
|
{
|
||||||
*version{|server|
|
*version{|server|
|
||||||
server ?? {server = Server.default};
|
server ?? {server = Server.default};
|
||||||
server.sendMsg("/cmd","/"++this.name++'/version');
|
server.sendMsg("/cmd","/"++this.name++'/version');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,44 +1,44 @@
|
|||||||
FluidSpectralShape : FluidRTMultiOutUGen {
|
FluidSpectralShape : FluidRTMultiOutUGen {
|
||||||
|
|
||||||
const <features=#[\centroid,\spread,\skewness,\kurtosis,\rolloff,\flatness,\crest];
|
const <features=#[\centroid,\spread,\skewness,\kurtosis,\rolloff,\flatness,\crest];
|
||||||
classvar featuresLookup;
|
classvar featuresLookup;
|
||||||
|
|
||||||
*initClass {
|
*initClass {
|
||||||
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
featuresLookup = Dictionary.with(*this.features.collect{|x,i| x->(1<<i)});
|
||||||
}
|
}
|
||||||
|
|
||||||
*prWarnUnrecognised {|sym| ("WARNING: FluidSpectralShape -" + sym + "is not a recognised option").postln}
|
|
||||||
|
|
||||||
*prProcessSelect {|a|
|
*prWarnUnrecognised {|sym| ("WARNING: FluidSpectralShape -" + sym + "is not a recognised option").postln}
|
||||||
var bits;
|
|
||||||
a.asBag.countsDo{|item,count,i|
|
*prProcessSelect {|a|
|
||||||
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
var bits;
|
||||||
};
|
a.asBag.countsDo{|item,count,i|
|
||||||
bits = a.collect{ |sym|
|
if(count > 1) { ("Option '" ++ item ++ "' is repeated").warn};
|
||||||
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
};
|
||||||
}.reduce{|x,y| x | y};
|
bits = a.collect{ |sym|
|
||||||
^bits
|
(featuresLookup[sym.asSymbol] !? {|x| x} ?? {this.prWarnUnrecognised(sym); 0})
|
||||||
}
|
}.reduce{|x,y| x | y};
|
||||||
|
^bits
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
*kr { arg in = 0, select, minFreq = 0, maxFreq = -1, rolloffPercent = 95, unit = 0, power = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = -1;
|
*kr { arg in = 0, select, minFreq = 0, maxFreq = -1, rolloffPercent = 95, unit = 0, power = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = -1;
|
||||||
|
|
||||||
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
var selectbits = select !? {this.prProcessSelect(select)} ?? {this.prProcessSelect(this.features)};
|
||||||
|
|
||||||
^this.multiNew('control', in.asAudioRateInput(this), selectbits, minFreq, maxFreq, rolloffPercent, unit, power, windowSize, hopSize, fftSize, maxFFTSize);
|
^this.multiNew('control', in.asAudioRateInput(this), selectbits, minFreq, maxFreq, rolloffPercent, unit, power, windowSize, hopSize, fftSize, maxFFTSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
init {arg ...theInputs;
|
init {arg ...theInputs;
|
||||||
var numChannels;
|
var numChannels;
|
||||||
inputs = theInputs;
|
inputs = theInputs;
|
||||||
numChannels = inputs.at(1).asBinaryDigits.sum;
|
numChannels = inputs.at(1).asBinaryDigits.sum;
|
||||||
^this.initOutputs(numChannels,rate);
|
^this.initOutputs(numChannels,rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkInputs {
|
checkInputs {
|
||||||
if(inputs.at(10).rate != 'scalar') {
|
if(inputs.at(10).rate != 'scalar') {
|
||||||
^(": maxFFTSize cannot be modulated.");
|
^(": maxFFTSize cannot be modulated.");
|
||||||
};
|
};
|
||||||
^this.checkValidInputs;
|
^this.checkValidInputs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue