commit
34ee65ab77
@ -0,0 +1,11 @@
|
||||
FluidAmpSlice : UGen {
|
||||
*ar { arg in = 0, absRampUp = 10, absRampDown = 10, absThreshOn = -40, absThreshOff = -40, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, relRampUp = 1, relRampDown = 1, relThreshOn = -144, relThreshOff = -144, highPassFreq = 250, maxSize = 88200, outputType = 0;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), absRampUp, absRampDown, absThreshOn, absThreshOff, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, relRampUp, relRampDown, relThreshOn, relThreshOff, highPassFreq, maxSize, outputType)
|
||||
}
|
||||
checkInputs {
|
||||
if(inputs.at(16).rate != 'scalar') {
|
||||
^(": maxSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
FluidBufAmpSlice{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, absRampUp = 10, absRampDown = 10, absThreshOn = -40, absThreshOff = -40, minSliceLength = 1, minSilenceLength = 1, minLengthAbove = 1, minLengthBelow = 1, lookBack = 0, lookAhead = 0, relRampUp = 1, relRampDown = 1, relThreshOn = -144, relThreshOff = -144, highPassFreq = 250, outputType = 0, action;
|
||||
|
||||
var maxSize = max(minLengthAbove + lookBack, max(minLengthBelow,lookAhead));
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufAmpSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufAmpSlice: Invalid features buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufAmpSlice, source, startFrame, numFrames, startChan, numChans, indices, absRampUp, absRampDown, absThreshOn, absThreshOff, minSliceLength, minSilenceLength, minLengthAbove, minLengthBelow, lookBack, lookAhead, relRampUp, relRampDown, relThreshOn, relThreshOff, highPassFreq, maxSize, outputType);
|
||||
server.sync;
|
||||
indices = server.cachedBufferAt(indices); indices.updateInfo; server.sync;
|
||||
action.value(indices);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,19 @@
|
||||
FluidBufCompose{
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, srcGain = 1, dstBufNum, dstStartAt = 0, dstStartChan = 0, dstGain = 0;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, gain = 1, destination, destStartFrame = 0, destStartChan = 0, destGain = 0, action;
|
||||
|
||||
if(srcBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
if(dstBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufCompose: Invalid source buffer".throw};
|
||||
destination.isNil.if {"FluidBufCompose: Invalid destination buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
server.sendMsg(\cmd, \BufCompose, srcBufNum, startAt, nFrames, startChan, nChans, srcGain, dstBufNum, dstStartAt, dstStartChan, dstGain);
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufCompose, source, startFrame, numFrames, startChan, numChans, gain, destination, destStartFrame, destStartChan, destGain);
|
||||
server.sync;
|
||||
destination = server.cachedBufferAt(destination); destination.updateInfo; server.sync;
|
||||
action.value(destination);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
FluidBufExperiments {
|
||||
|
||||
*allocMatch{|server, srcbuf, rank=1|
|
||||
var dstbuf,srcbufnum;
|
||||
|
||||
srcbufnum = srcbuf.bufnum;
|
||||
|
||||
server = server ? Server.default;
|
||||
dstbuf = Buffer.new(server:server,numFrames:0,numChannels:1);
|
||||
|
||||
server.listSendMsg(
|
||||
[\b_gen, srcbufnum, "BufMatch",dstbuf.bufnum, rank]
|
||||
);
|
||||
^dstbuf;
|
||||
}
|
||||
|
||||
|
||||
*allocMatchAsync{|server, srcbuf, rank=1|
|
||||
|
||||
var dstbuf,srcbufnum;
|
||||
|
||||
srcbufnum = srcbuf.bufnum;
|
||||
server = server ? Server.default;
|
||||
dstbuf = Buffer.new(server:server,numFrames:0,numChannels:1);
|
||||
server.sendMsg(\cmd, \AsyncBufMatch, srcbufnum, dstbuf.bufnum, rank);
|
||||
^dstbuf;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,16 +1,30 @@
|
||||
FluidBufHPSS{
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, harmBufNum, percBufNum, resBufNum, hFiltSize = 17, pFiltSize = 31, modeFlag, htf1 = 0.1, hta1 = 0, htf2 = 0.5, hta2 = 0, ptf1 = 0.1, pta1 = 0, ptf2 = 0.5, pta2 = 0, winSize = 1024, hopSize = -1, fftSize = -1;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, harmonic, percussive, residual, harmFilterSize = 17, percFilterSize = 31, maskingMode, 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;
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
harmonic = harmonic.asUGenInput;
|
||||
percussive = percussive.asUGenInput;
|
||||
residual = residual.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufHPSS: Invalid source buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
harmBufNum = harmBufNum ? -1;
|
||||
percBufNum = percBufNum ? -1;
|
||||
harmonic = harmonic ? -1;
|
||||
percussive = percussive ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
//For wrapped RT clients, send maximal param values as aliases of the ones that are passed
|
||||
//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)
|
||||
|
||||
server.sendMsg(\cmd, \BufHPSS, srcBufNum, startAt, nFrames, startChan, nChans, harmBufNum, percBufNum, resBufNum, hFiltSize, pFiltSize, modeFlag, htf1, hta1, htf2, hta2, ptf1, pta1, ptf2, pta2, winSize, hopSize, fftSize, maxFFTSize, hFiltSize, pFiltSize);
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufHPSS, 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);
|
||||
server.sync;
|
||||
if (harmonic != -1) {harmonic = server.cachedBufferAt(harmonic); harmonic.updateInfo; server.sync;} {harmonic = nil};
|
||||
if (percussive != -1) {percussive = server.cachedBufferAt(percussive); percussive.updateInfo; server.sync;} {percussive = nil};
|
||||
if (residual != -1) {residual = server.cachedBufferAt(residual); residual.updateInfo; server.sync;} {residual = nil};
|
||||
action.value(harmonic, percussive, residual);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
FluidBufLoudness{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, 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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufLoudness, source, startFrame, numFrames, startChan, numChans, features, kWeighting, truePeak, windowSize, hopSize, maxwindowSize);
|
||||
server.sync;
|
||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||
action.value(features);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
FluidBufMFCC{
|
||||
*process { arg 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;
|
||||
|
||||
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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
//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
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufMFCC, source, startFrame, numFrames, startChan, numChans, features, numCoeffs, numBands, minFreq, maxFreq, numCoeffs, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||
action.value(features);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
FluidBufMelBands{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, numBands = 40, minFreq = 20, maxFreq = 20000, windowSize = 1024, hopSize = -1, fftSize = -1, 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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
//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
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufMelBands, source, startFrame, numFrames, startChan, numChans, features, numBands, minFreq, maxFreq, numBands, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||
action.value(features);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,13 +1,27 @@
|
||||
FluidBufNMF {
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, dstBufNum, dictBufNum, dictFlag = 0, actBufNum, actFlag = 0, rank = 1, nIter = 100, sortFlag = 0, winSize = 1024, hopSize = -1, fftSize = -1, winType = 0, randSeed = -1;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action;
|
||||
|
||||
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
|
||||
source = source.asUGenInput;
|
||||
destination = destination.asUGenInput;
|
||||
bases = bases.asUGenInput;
|
||||
activations = activations.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
dstBufNum = dstBufNum ? -1;
|
||||
dictBufNum = dictBufNum ? -1;
|
||||
actBufNum = actBufNum ? -1;
|
||||
|
||||
server.sendMsg(\cmd, \BufNMF, srcBufNum, startAt, nFrames, startChan, nChans, dstBufNum, dictBufNum, dictFlag, actBufNum, actFlag, rank, nIter, winSize, hopSize, fftSize);
|
||||
destination = destination ? -1;
|
||||
bases = bases ? -1;
|
||||
activations = activations ? -1;
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufNMF, source, startFrame, numFrames, startChan, numChans, destination, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize);
|
||||
server.sync;
|
||||
if (destination != -1) {destination = server.cachedBufferAt(destination); destination.updateInfo; server.sync;} {destination = nil};
|
||||
if (bases != -1) {bases = server.cachedBufferAt(bases); bases.updateInfo; server.sync;} {bases = nil};
|
||||
if (activations != -1) {activations = server.cachedBufferAt(activations); activations.updateInfo; server.sync;} {activations = nil};
|
||||
action.value(destination, bases, activations);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,21 @@
|
||||
FluidBufNoveltySlice{
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, kernSize = 3, thresh = 0.8, filtSize = 1, winSize = 1024, hopSize = -1, fftSize = -1;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, kernelSize = 3, threshold = 0.8, filterSize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action;
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
|
||||
//var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize}; //ready for when we need it from the RT wrapper
|
||||
|
||||
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
if(indBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
server.sendMsg(\cmd, \BufNoveltySlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, kernSize, thresh, filtSize, winSize, hopSize, maxFFTSize);
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufNoveltySlice, source, startFrame, numFrames, startChan, numChans, indices, kernelSize, threshold, filterSize, windowSize, hopSize, fftSize);
|
||||
server.sync;
|
||||
indices = server.cachedBufferAt(indices); indices.updateInfo; server.sync;
|
||||
action.value(indices);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
FluidBufOnsetSlice{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, function = 0, threshold = 0.1, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, action;
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufOnsetSlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufOnsetSlice: Invalid features buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
//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)
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufOnsetSlice, source, startFrame, numFrames, startChan, numChans, indices, function, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
indices = server.cachedBufferAt(indices); indices.updateInfo; server.sync;
|
||||
action.value(indices);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
FluidBufPitch{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, algorithm = 2, windowSize = 1024, hopSize = -1, fftSize = -1, 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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
//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)
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufPitch, source, startFrame, numFrames, startChan, numChans, features, algorithm, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||
action.value(features);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
FluidBufRTNoveltySlice{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, indices, feature = 0, kernelSize = 3, threshold = 0.8, filterSize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, 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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufRTNoveltySlice, source, startFrame, numFrames, startChan, numChans, indices, feature, kernelSize, threshold, filterSize, windowSize, hopSize, fftSize, maxFFTSize, kernelSize, filterSize);
|
||||
server.sync;
|
||||
indices = server.cachedBufferAt(indices); indices.updateInfo; server.sync;
|
||||
action.value(indices);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,27 @@
|
||||
FluidBufSines{
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, sineBufNum, resBufNum, bw = 76, thresh = 0.7, minTrackLen = 15, magWeight = 0.1, freqWeight = 1, winSize = 1024, hopSize = -1, fftSize = -1;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, sines, residual, bandwidth = 76, threshold = 0.7, minTrackLen = 15, magWeight = 0.1, freqWeight = 1, windowSize = 1024, hopSize = -1, fftSize = -1, action;
|
||||
|
||||
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
|
||||
var maxFFTSize = if (fftSize == -1) {windowSize.nextPowerOfTwo} {fftSize};
|
||||
|
||||
if(srcBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
sines = sines.asUGenInput;
|
||||
residual = residual.asUGenInput;
|
||||
|
||||
server = server ? Server.default;
|
||||
sineBufNum = sineBufNum ? -1;
|
||||
resBufNum = resBufNum ? -1;
|
||||
source.isNil.if {"FluidBufSines: Invalid source buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
sines = sines ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
//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)
|
||||
|
||||
server.sendMsg(\cmd, \BufSines, srcBufNum, startAt, nFrames, startChan, nChans, sineBufNum, resBufNum, bw, thresh, minTrackLen, magWeight, freqWeight, winSize, hopSize, fftSize, maxFFTSize);
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufSines, source, startFrame, numFrames, startChan, numChans, sines, residual, bandwidth, threshold, minTrackLen, magWeight, freqWeight, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
if (sines != -1) {sines = server.cachedBufferAt(sines); sines.updateInfo; server.sync;} {sines = nil};
|
||||
if (residual != -1) {residual = server.cachedBufferAt(residual); residual.updateInfo; server.sync;} {residual = nil};
|
||||
action.value(sines, residual);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
FluidBufSpectralShape{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, features, windowSize = 1024, hopSize = -1, fftSize = -1, 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};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
//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)
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufSpectralShape, source, startFrame, numFrames, startChan, numChans, features, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
server.sync;
|
||||
features = server.cachedBufferAt(features); features.updateInfo; server.sync;
|
||||
action.value(features);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
FluidBufStats{
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, stats, numDerivs = 0, low = 0, middle = 50, high = 100, action;
|
||||
|
||||
source = source.asUGenInput;
|
||||
stats = stats.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufStats: Invalid source buffer".throw};
|
||||
stats.isNil.if {"FluidBufStats: Invalid stats buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufStats, source, startFrame, numFrames, startChan, numChans, stats, numDerivs, low, middle, high);
|
||||
server.sync;
|
||||
stats = server.cachedBufferAt(stats); stats.updateInfo; server.sync;
|
||||
action.value(stats);
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,11 +1,19 @@
|
||||
FluidBufTransientSlice{
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, transBufNum, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, winSize = 14, debounce = 25, minSlice = 1000;
|
||||
*process { arg 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;
|
||||
|
||||
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
if(transBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
indices = indices.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufNoveltySlice: Invalid source buffer".throw};
|
||||
indices.isNil.if {"FluidBufNoveltySlice: Invalid features buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
|
||||
server.sendMsg(\cmd, \BufTransientSlice, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce, minSlice);
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufTransientSlice, source, startFrame, numFrames, startChan, numChans, indices, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength, minSliceLength);
|
||||
server.sync;
|
||||
indices = server.cachedBufferAt(indices); indices.updateInfo; server.sync;
|
||||
action.value(indices);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +1,22 @@
|
||||
FluidBufTransients {
|
||||
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, transBufNum, resBufNum, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, winSize = 14, debounce = 25;
|
||||
*process { arg server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, transients, residual, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, windowSize = 14, clumpLength = 25, action;
|
||||
|
||||
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
|
||||
source = source.asUGenInput;
|
||||
transients = transients.asUGenInput;
|
||||
residual = residual.asUGenInput;
|
||||
|
||||
source.isNil.if {"FluidBufTransients: Invalid source buffer".throw};
|
||||
|
||||
server = server ? Server.default;
|
||||
transBufNum = transBufNum ? -1;
|
||||
resBufNum = resBufNum ? -1;
|
||||
transients = transients ? -1;
|
||||
residual = residual ? -1;
|
||||
|
||||
("Source" + srcBufNum).postln;
|
||||
("Trans" + transBufNum).postln;
|
||||
("Res" + resBufNum).postln;
|
||||
server.sendMsg(\cmd, \BufTransients, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, resBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce);
|
||||
forkIfNeeded{
|
||||
server.sendMsg(\cmd, \BufTransients, source, startFrame, numFrames, startChan, numChans, transients, residual, order, blockSize, padSize, skew, threshFwd, threshBack, windowSize, clumpLength);
|
||||
server.sync;
|
||||
if (transients != -1) {transients = server.cachedBufferAt(transients); transients.updateInfo; server.sync;} {transients = nil};
|
||||
if (residual != -1) {residual = server.cachedBufferAt(residual); residual.updateInfo; server.sync;} {residual = nil};
|
||||
action.value(transients, residual);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
FluidLoudness : MultiOutUGen {
|
||||
*kr { arg in = 0, kWeighting = 1, truePeak = 1, windowSize = 1024, hopSize = 512, maxwindowSize = 16384;
|
||||
^this.multiNew('control', in.asAudioRateInput(this), kWeighting, truePeak, windowSize, hopSize, maxwindowSize);
|
||||
}
|
||||
|
||||
init {arg ...theInputs;
|
||||
inputs = theInputs;
|
||||
^this.initOutputs(2,rate);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(5).rate != 'scalar') {
|
||||
^(": maxwindowSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
FluidMFCC : MultiOutUGen {
|
||||
|
||||
*kr { arg in = 0, numCoeffs = 13, numBands = 40, minFreq = 20, maxFreq = 20000, maxNumCoeffs = 40, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^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);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(5).rate != 'scalar') {
|
||||
^(": maxNumCoeffs cannot be modulated.");
|
||||
};
|
||||
if(inputs.at(9).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
FluidMelBands : MultiOutUGen {
|
||||
|
||||
*kr { arg in = 0, numBands = 40, minFreq = 20, maxFreq = 20000, maxNumBands = 120, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^this.multiNew('control', in.asAudioRateInput(this), numBands, minFreq, maxFreq, maxNumBands, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
}
|
||||
|
||||
init {arg ...theInputs;
|
||||
inputs = theInputs;
|
||||
^this.initOutputs(inputs.at(4),rate);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(4).rate != 'scalar') {
|
||||
^(": maxNumBands cannot be modulated.");
|
||||
};
|
||||
if(inputs.at(8).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
FluidNMFFilter : MultiOutUGen {
|
||||
|
||||
*ar { arg in = 0, bases, maxComponents = 1, iterations = 10, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), bases, maxComponents, iterations, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
}
|
||||
|
||||
init {arg ...theInputs;
|
||||
inputs = theInputs;
|
||||
^this.initOutputs(inputs[2],rate);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(2).rate != 'scalar') {
|
||||
^(": maxComponents cannot be modulated.");
|
||||
};
|
||||
if(inputs.at(7).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
FluidOnsetSlice : UGen {
|
||||
*ar { arg in = 0, function = 0, threshold = 0.5, minSliceLength = 2, filterSize = 5, frameDelta = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), function, threshold, minSliceLength, filterSize, frameDelta, windowSize, hopSize, fftSize, maxFFTSize)
|
||||
}
|
||||
checkInputs {
|
||||
if(inputs.at(9).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
FluidPitch : MultiOutUGen {
|
||||
|
||||
*kr { arg in = 0, algorithm = 2, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^this.multiNew('control', in.asAudioRateInput(this), algorithm, windowSize, hopSize, fftSize, maxFFTSize);
|
||||
}
|
||||
|
||||
init {arg ...theInputs;
|
||||
inputs = theInputs;
|
||||
^this.initOutputs(2,rate);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(5).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
FluidRTNoveltySlice : UGen {
|
||||
*ar { arg in = 0, feature = 0, kernelSize = 3, threshold = 0.8, filterSize = 1, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384, maxKernelSize = 101, maxFilterSize = 100;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), feature, kernelSize, threshold, filterSize, windowSize, hopSize, fftSize, maxFFTSize, maxKernelSize, maxFilterSize)
|
||||
}
|
||||
checkInputs {
|
||||
if(inputs.at(8).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};
|
||||
if(inputs.at(9).rate != 'scalar') {
|
||||
^(": maxKernelSize cannot be modulated.");
|
||||
};
|
||||
if(inputs.at(10).rate != 'scalar') {
|
||||
^(": maxFilterSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,11 @@
|
||||
FluidSTFTPass : UGen {
|
||||
*ar { arg in = 0, winSize= 1024, hopSize= -1, fftSize= -1, maxFFTSize = 16384;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), winSize, hopSize, fftSize, maxFFTSize)
|
||||
*ar { arg in = 0, windowSize= 1024, hopSize= -1, fftSize= -1, maxFFTSize = 16384;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), windowSize, hopSize, fftSize, maxFFTSize)
|
||||
}
|
||||
checkInputs {
|
||||
if(inputs.at(4).rate != 'scalar') {
|
||||
^": maxFFTSize cannot be modulated.";
|
||||
};
|
||||
^this.checkValidInputs
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
FluidSpectralShape : MultiOutUGen {
|
||||
|
||||
*kr { arg in = 0, windowSize = 1024, hopSize = -1, fftSize = -1, maxFFTSize = 16384;
|
||||
^this.multiNew('control', in.asAudioRateInput(this), windowSize, hopSize, fftSize, maxFFTSize);
|
||||
}
|
||||
|
||||
init {arg ...theInputs;
|
||||
inputs = theInputs;
|
||||
^this.initOutputs(7,rate);
|
||||
}
|
||||
|
||||
checkInputs {
|
||||
if(inputs.at(4).rate != 'scalar') {
|
||||
^(": maxFFTSize cannot be modulated.");
|
||||
};
|
||||
^this.checkValidInputs;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
FluidTransientSlice : UGen {
|
||||
*ar { arg in = 0, order = 20, blockSize = 256, padSize = 128, skew = 0.0, threshFwd = 2.0, threshBack = 1.1, winSize=14, debounce=25, minSlice = 1000;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), order, blockSize, padSize, skew, threshFwd ,threshBack, winSize, debounce, minSlice)
|
||||
*ar { arg in = 0, order = 20, blockSize = 256, padSize = 128, skew = 0.0, threshFwd = 2.0, threshBack = 1.1, windowSize=14, clumpLength=25, minSliceLength = 1000;
|
||||
^this.multiNew('audio', in.asAudioRateInput(this), order, blockSize, padSize, skew, threshFwd ,threshBack, windowSize, clumpLength, minSliceLength)
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
//this patch requests a folder and will iterate through all accepted audiofiles and concatenate them in the destination buffer. It will also yield an array with the numFrame where files start in the new buffer.
|
||||
|
||||
(
|
||||
var fileNames;
|
||||
c = [0];
|
||||
|
||||
FileDialog.new({|selection|
|
||||
var total, totaldur = 0, maxchans = 0;
|
||||
t = Main.elapsedTime;
|
||||
fileNames = PathName.new(selection[0])
|
||||
.entries
|
||||
.select({|f|
|
||||
[\wav, \WAV, \mp3,\aif].includes(f.extension.asSymbol);});
|
||||
total = fileNames.size();
|
||||
fileNames.do({arg fp;
|
||||
SoundFile.use(fp.asAbsolutePath , {
|
||||
arg file;
|
||||
var dur = file.numFrames;
|
||||
c = c.add(dur);
|
||||
totaldur = totaldur + dur;
|
||||
maxchans = maxchans.max(file.numChannels);
|
||||
});
|
||||
});
|
||||
c.postln;
|
||||
totaldur.postln;
|
||||
maxchans.postln;
|
||||
Routine{
|
||||
b = Buffer.alloc(s,totaldur,maxchans);
|
||||
s.sync;
|
||||
fileNames.do{|f, i|
|
||||
f.postln;
|
||||
("Loading"+(i+1)+"of"+total).postln;
|
||||
Buffer.read(s, f.asAbsolutePath,action:{arg tempbuf; FluidBufCompose.process(s,tempbuf,destination:b,destStartFrame:c[i],action:{tempbuf.free});});
|
||||
s.sync;
|
||||
};
|
||||
("loading buffers done in" + (Main.elapsedTime - t).round(0.1) + "seconds.").postln;
|
||||
}.play;
|
||||
}, fileMode:2);
|
||||
)
|
||||
|
||||
b.plot
|
||||
c.postln
|
||||
b.play
|
||||
|
||||
Buffer.freeAll
|
||||
@ -0,0 +1,38 @@
|
||||
//destination buffer
|
||||
(
|
||||
b = Buffer.new();
|
||||
c = Array.new();
|
||||
)
|
||||
|
||||
//this patch requests a folder and will iterate through all accepted audiofiles and concatenate them in the destination buffer. It will also yield an array with the numFrame where files start in the new buffer.
|
||||
|
||||
(
|
||||
var tempbuf,dest=0, fileNames;
|
||||
|
||||
FileDialog.new({|selection|
|
||||
var total;
|
||||
t = Main.elapsedTime;
|
||||
fileNames = PathName.new(selection[0])
|
||||
.entries
|
||||
.select({|f|
|
||||
[\wav, \WAV, \mp3,\aif].includes(f.extension.asSymbol);});
|
||||
total = fileNames.size();
|
||||
Routine{
|
||||
fileNames.do{|f, i|
|
||||
f.postln;
|
||||
("Loading"+(i+1)+"of"+total).postln;
|
||||
tempbuf = Buffer.read(s,f.asAbsolutePath);
|
||||
s.sync;
|
||||
c = c.add(dest);
|
||||
FluidBufCompose.process(s,tempbuf,destStartFrame:dest,destination:b);
|
||||
s.sync;
|
||||
dest = b.numFrames;
|
||||
};
|
||||
("loading buffers done in" + (Main.elapsedTime - t).round(0.1) + "seconds.").postln;
|
||||
}.play;
|
||||
}, fileMode:2);
|
||||
)
|
||||
|
||||
b.plot
|
||||
c.postln
|
||||
b.play
|
||||
@ -0,0 +1,57 @@
|
||||
s.reboot
|
||||
|
||||
//this patch does just-in-time nmf processes on buffer, faking a slightly delayed real-time version of it
|
||||
//what is happening:
|
||||
//a circular buffer is doing a fake real time - every half second, it sends a frame to be proceesed by NMF~, requesting 3 ranks. Because this latter process is randomly seeded and not sorted, the 3 ranks are not getting similar results each time, hence the random pan
|
||||
|
||||
(
|
||||
b = Buffer.alloc(s,s.sampleRate * 2);
|
||||
c = Buffer.new(s,0,3);
|
||||
d = Buffer.new(s,0,3);
|
||||
e = Buffer.read(s,File.realpath(FluidBufNMF.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Nicol-LoopE-M.wav");
|
||||
g = Bus.audio(s,1);
|
||||
h = Buffer.loadCollection(s, Signal.rectWindow(22491).fade(0,440).fade(22049,22489,1,0).put(22490,0));
|
||||
|
||||
SynthDef(\becauseIcan,{arg bufnum = 0, nmfa = 0, nmfb = 0, input = 0, env = 0;
|
||||
var head, head2, duration, audioin, halfdur;
|
||||
duration = BufFrames.kr(bufnum) / 2;
|
||||
halfdur = duration / 2;
|
||||
head = Phasor.ar(0,1,0,duration);
|
||||
head2 = (head + halfdur) % duration;
|
||||
|
||||
// circular buffer writer
|
||||
audioin = In.ar(input,1);
|
||||
BufWr.ar(audioin,bufnum,head,0);
|
||||
BufWr.ar(audioin,bufnum,head+duration,0);
|
||||
|
||||
// cue the calculations via the language
|
||||
SendReply.ar(head > 500, '/processplease',2);
|
||||
SendReply.ar(head > (halfdur + 500), '/processplease',1);
|
||||
|
||||
// read the 2 buffers with an envelop
|
||||
Out.ar(0, Splay.ar(BufRd.ar(3,nmfa,head,0,1) * BufRd.ar(1,env,head,0,1)) + Splay.ar(BufRd.ar(3,nmfb,head2,0,1) * BufRd.ar(1,env,head2,0,1)));
|
||||
}).add;
|
||||
|
||||
SynthDef(\playa, { arg output = 0, bufnum = 0;
|
||||
Out.ar(output,PlayBuf.ar(1,bufnum,loop:1));
|
||||
}).add;
|
||||
)
|
||||
|
||||
// instantiate the player
|
||||
x = Synth(\playa,[\output, g.index, \bufnum, e.bufnum]);
|
||||
|
||||
// instantiate the processor
|
||||
y = Synth(\becauseIcan,[\bufnum, b.bufnum, \nmfa, c.bufnum, \nmfb, d.bufnum, \input, g.index, \env, h.bufnum], x, 'addAfter');
|
||||
|
||||
// instantiate the listener to cue the processing from the language side
|
||||
(
|
||||
w = OSCFunc({ arg msg;
|
||||
if(msg[3]== 1, {
|
||||
FluidBufNMF.process(s, b, numFrames: 22500, destination: c.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256);
|
||||
}, {
|
||||
FluidBufNMF.process(s, b, 22050, 22500, destination: d.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256);
|
||||
});}, '/processplease', s.addr);
|
||||
)
|
||||
|
||||
// stop it all
|
||||
b.free;c.free;d.free;e.free;f.free;g.free;w.clear;x.free; y.free;
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -1,157 +0,0 @@
|
||||
//Can I reallocate buffers on the server? Yes I can.
|
||||
#include "SC_PlugIn.h"
|
||||
|
||||
static InterfaceTable *ft;
|
||||
|
||||
|
||||
|
||||
//Can we do buffer resizing in a BufGen. I think so.
|
||||
//Goal here is to mimic the NMF case, allowing
|
||||
//the dst buffer to be resized accordingly (and not need to
|
||||
// precalculate the number of frames in advance lang-side
|
||||
|
||||
/**
|
||||
/buf_gen approach: Seems to work, but having to do the 'swap' bewteen NRT mirror buffer and RT buffer
|
||||
in the same thread seems smelly, given how the allocation sequeneces in SC_SequenceCommand seem to work.
|
||||
**/
|
||||
void bufferMatch(World *world, struct SndBuf *srcBuf, struct sc_msg_iter *msg) {
|
||||
size_t srcFrameCount = srcBuf->frames;
|
||||
size_t srcChanCount = srcBuf->channels;
|
||||
|
||||
long dstBufNum = msg->geti();
|
||||
size_t rank = msg->geti();
|
||||
|
||||
if (dstBufNum == -1) {
|
||||
Print("BufferMatch is not happy because there is no output buffer "
|
||||
"specified.\n");
|
||||
return;
|
||||
}
|
||||
// This sequence follows what I saw in SC_SequenceCommand.cpp. Pretty much.
|
||||
// Get the NRT thread mirror buffer
|
||||
SndBuf *dstBufNRT = World_GetNRTBuf(world, dstBufNum);
|
||||
// Call the allocation function on that
|
||||
SCErr err = ft->fBufAlloc(dstBufNRT, srcChanCount * rank, srcFrameCount,
|
||||
srcBuf->samplerate);
|
||||
// If we were posh, we'd check for errors
|
||||
// Norhing will happen, unless we (a) assign the allocated data back to the
|
||||
// main buffer pool (b?) Tell the server the buffer has changed Get the RT
|
||||
// buffer
|
||||
SndBuf *dstBuf = World_GetBuf(world, dstBufNum);
|
||||
// Assign value to our NRT buffer pointer's value
|
||||
*dstBuf = *dstBufNRT;
|
||||
// Ping the server
|
||||
world->mSndBufUpdates[dstBufNum].writes++;
|
||||
}
|
||||
|
||||
/**
|
||||
ASync command version. Is this an abuse of Async command? Doesn't *seem* to be, but there is almost no
|
||||
documentation for its proper use :-|
|
||||
**/
|
||||
//Struct that holds all our state between stages
|
||||
struct BufferFunTimeCmdData
|
||||
{
|
||||
long dstbuf;
|
||||
long srcbuf;
|
||||
size_t rank;
|
||||
|
||||
SndBuf* newdst;
|
||||
};
|
||||
|
||||
//'Stage2()' happens in the NRT thread. Here we do our heavy stuff
|
||||
bool aSyncBufferFunNrtStage(World *world, void *inUserData) {
|
||||
BufferFunTimeCmdData *data = (BufferFunTimeCmdData *)inUserData;
|
||||
|
||||
SndBuf *src = World_GetNRTBuf(world, data->srcbuf);
|
||||
SndBuf *dst = World_GetNRTBuf(world, data->dstbuf);
|
||||
SCErr err = ft->fBufAlloc(dst, src->channels * data->rank, src->frames,
|
||||
src->samplerate);
|
||||
data->newdst = dst;
|
||||
return true;
|
||||
}
|
||||
|
||||
//'Statge3()' happens back in the RT thread, here we swap our new buffers
|
||||
//SC will send the completion message after this
|
||||
bool aSyncBufferFunRtStage(World *world, void *inUserData) {
|
||||
BufferFunTimeCmdData *data = (BufferFunTimeCmdData *)inUserData;
|
||||
// Norhing will happen, unless we (a) assign the allocated data back to the
|
||||
// main buffer pool (b?) Tell the server the buffer has changed Get the RT
|
||||
// buffer
|
||||
SndBuf *dstBuf = World_GetBuf(world, data->dstbuf);
|
||||
// Assign value to our NRT buffer pointer's value
|
||||
*dstBuf = *data->newdst;
|
||||
// Ping the server
|
||||
world->mSndBufUpdates[data->dstbuf].writes++;
|
||||
return true;
|
||||
}
|
||||
|
||||
//'Stage 4()' is back on the NRT, we don't have anything to do here. SC will send 'done' after this
|
||||
bool aSyncBufferFunFinalBit(World *world, void *inUserData) { return true; }
|
||||
|
||||
//Here we free any resources, including the struct we made at the start
|
||||
void aSyncBufferFunCleanUp(World *world, void *inUserData) {
|
||||
BufferFunTimeCmdData *data = (BufferFunTimeCmdData *)inUserData;
|
||||
RTFree(world, data);
|
||||
// scsynth will take care of the completion message
|
||||
}
|
||||
|
||||
//This is our entry point. We need to make a struct and populate it with good things
|
||||
void aSyncBufferFunMain(World *inWorld, void *inUserData,
|
||||
struct sc_msg_iter *msg, void *replyAddr) {
|
||||
BufferFunTimeCmdData *data =
|
||||
(BufferFunTimeCmdData *)RTAlloc(inWorld, sizeof(BufferFunTimeCmdData));
|
||||
|
||||
data->srcbuf = msg->geti();
|
||||
data->dstbuf = msg->geti();
|
||||
data->rank = msg->geti();
|
||||
|
||||
bool ok = true;
|
||||
|
||||
if (data->srcbuf < 0) {
|
||||
Print("No source buffer");
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (data->dstbuf < 0) {
|
||||
Print("No dst buffer");
|
||||
ok = false;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
RTFree(inWorld, data);
|
||||
return;
|
||||
}
|
||||
|
||||
// how to pass a string argument: [WILL BE USEFUL FOR WINDOW FUNCTIONS?]
|
||||
// const char *name = msg->gets(); // get the string argument
|
||||
// if (name) {
|
||||
// data->name = (char*)RTAlloc(inWorld, strlen(name)+1); // allocate
|
||||
// space, free it in cmdCleanup. strcpy(data->name, name); // copy the
|
||||
// string
|
||||
// }
|
||||
|
||||
//Deal with completion message
|
||||
size_t completionMsgSize = msg->getbsize();
|
||||
char* completionMsgString = 0;
|
||||
if(completionMsgSize)
|
||||
{
|
||||
//allocate string
|
||||
completionMsgString = (char*)RTAlloc(inWorld,completionMsgSize);
|
||||
msg->getb(completionMsgString,completionMsgSize);
|
||||
}
|
||||
|
||||
//Now, set the wheels in motion
|
||||
DoAsynchronousCommand(inWorld, replyAddr, "AsyncBufMatch", data,
|
||||
(AsyncStageFn)aSyncBufferFunNrtStage,
|
||||
(AsyncStageFn)aSyncBufferFunRtStage,
|
||||
(AsyncStageFn)aSyncBufferFunFinalBit,
|
||||
aSyncBufferFunCleanUp, completionMsgSize,
|
||||
completionMsgString);
|
||||
}
|
||||
|
||||
PluginLoad(BufferFunTime) {
|
||||
ft = inTable;
|
||||
//BufGen version: all in the NRT thread
|
||||
DefineBufGen("BufMatch", bufferMatch);
|
||||
//ASync version: swaps between NRT and RT threads
|
||||
DefinePlugInCmd("AsyncBufMatch", aSyncBufferFunMain, nullptr);
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
s.reboot
|
||||
|
||||
//Quickie test of buffer allocation working
|
||||
//Read a sound file
|
||||
a = Buffer.read(s,"../../release-packaging/AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav".resolveRelative);
|
||||
//size it appropriately (in our server code) and return the new object
|
||||
f = FluidBufExperiments.allocMatch(s,a,rank:5);
|
||||
//Make sure everything is kosher:
|
||||
a.query
|
||||
f.query
|
||||
|
||||
|
||||
//Try full async version
|
||||
s.reboot
|
||||
|
||||
//Quickie test of buffer allocation working
|
||||
//Read a sound file
|
||||
a = Buffer.read(s,"../../release-packaging/AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav".resolveRelative);
|
||||
//Pass buffer to this, along with a rank. It will allocate a new buffer,
|
||||
//size it appropriately (in our server code) and return the new object
|
||||
f = FluidBufExperiments.allocMatchAsync(s,a,rank:5);
|
||||
//Make sure everything is kosher:
|
||||
a.query
|
||||
f.query
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -1,10 +1,12 @@
|
||||
|
||||
#include <clients/nrt/NMFClient.hpp>
|
||||
#include <FluidSCWrapper.hpp>
|
||||
|
||||
static InterfaceTable *ft;
|
||||
|
||||
PluginLoad(OfflineFluidDecompositionUGens) {
|
||||
PluginLoad(OfflineFluidDecompositionUGens)
|
||||
{
|
||||
ft = inTable;
|
||||
using namespace fluid::client;
|
||||
makeSCWrapper<NMFClient,double,float>("BufNMF",NMFParams, ft);
|
||||
makeSCWrapper<NMFClient>("BufNMF", ft);
|
||||
}
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.3)
|
||||
get_filename_component(PLUGIN ${CMAKE_CURRENT_LIST_DIR} NAME_WE)
|
||||
message("Configuring ${PLUGIN}")
|
||||
set(FILENAME ${PLUGIN}.cpp)
|
||||
|
||||
add_library(
|
||||
${PLUGIN}
|
||||
MODULE
|
||||
${FILENAME}
|
||||
)
|
||||
|
||||
target_include_directories(
|
||||
${PLUGIN} PRIVATE ${CMAKE_CURRENT_LIST_DIR}/../../include
|
||||
)
|
||||
|
||||
target_link_libraries(
|
||||
${PLUGIN} PRIVATE FLUID_DECOMPOSITION
|
||||
)
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../../scripts/target_post.cmake)
|
||||
@ -1,11 +1,13 @@
|
||||
|
||||
#include <clients/nrt/FluidNRTClientWrapper.hpp>
|
||||
#include <clients/rt/TransientClient.hpp>
|
||||
#include <FluidSCWrapper.hpp>
|
||||
|
||||
static InterfaceTable *ft;
|
||||
|
||||
PluginLoad(OfflineFluidDecompositionUGens) {
|
||||
PluginLoad(OfflineFluidDecompositionUGens)
|
||||
{
|
||||
ft = inTable;
|
||||
using namespace fluid::client;
|
||||
makeSCWrapper<NRTTransients,double,float>("BufTransients",NRTTransientParams,ft);
|
||||
makeSCWrapper<NRTTransients>("BufTransients", ft);
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue