all buf* classes have a 'action' argument now and sync properly.

nix
Pierre Alexandre Tremblay 7 years ago
parent 43fdf6dee3
commit 80cce5d085

@ -1,5 +1,5 @@
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, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, srcGain = 1, dstBufNum, dstStartAt = 0, dstStartChan = 0, dstGain = 0, action;
srcBufNum = srcBufNum.asUGenInput;
dstBufNum = dstBufNum.asUGenInput;
@ -8,6 +8,12 @@ FluidBufCompose{
if(dstBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
server = server ? Server.default;
server.sendMsg(\cmd, \BufCompose, srcBufNum, startAt, nFrames, startChan, nChans, srcGain, dstBufNum, dstStartAt, dstStartChan, dstGain);
forkIfNeeded{
server.sendMsg(\cmd, \BufCompose, srcBufNum, startAt, nFrames, startChan, nChans, srcGain, dstBufNum, dstStartAt, dstStartChan, dstGain);
server.sync;
dstBufNum = server.cachedBufferAt(dstBufNum); dstBufNum.updateInfo; server.sync;
action.value(dstBufNum);
};
}
}

@ -1,5 +1,5 @@
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, 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, action;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
@ -13,9 +13,18 @@ FluidBufHPSS{
server = server ? Server.default;
harmBufNum = harmBufNum ? -1;
percBufNum = percBufNum ? -1;
resBufNum = resBufNum ? -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, 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);
server.sync;
if (harmBufNum != -1) {harmBufNum = server.cachedBufferAt(harmBufNum); harmBufNum.updateInfo; server.sync;} {harmBufNum = nil};
if (percBufNum != -1) {percBufNum = server.cachedBufferAt(percBufNum); percBufNum.updateInfo; server.sync;} {percBufNum = nil};
if (resBufNum != -1) {resBufNum = server.cachedBufferAt(resBufNum); resBufNum.updateInfo;server.sync;} {resBufNum = nil};
action.value(harmBufNum, percBufNum, resBufNum);
};
}
}

@ -1,5 +1,5 @@
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, 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, action;
srcBufNum = srcBufNum.asUGenInput;
@ -10,10 +10,18 @@ FluidBufNMF {
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).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);
forkIfNeeded{
server.sendMsg(\cmd, \BufNMF, srcBufNum, startAt, nFrames, startChan, nChans, dstBufNum, dictBufNum, dictFlag, actBufNum, actFlag, rank, nIter, winSize, hopSize, fftSize);
server.sync;
if (dstBufNum != -1) {dstBufNum = server.cachedBufferAt(dstBufNum); dstBufNum.updateInfo; server.sync;} {dstBufNum = nil};
if (dictBufNum != -1) {dictBufNum = server.cachedBufferAt(dictBufNum); dictBufNum.updateInfo;server.sync;} {dictBufNum = nil};
if (actBufNum != -1) {actBufNum = server.cachedBufferAt(actBufNum); actBufNum.updateInfo;server.sync;} {actBufNum = nil};
action.value(dstBufNum,dictBufNum,actBufNum);
};
}
}

@ -1,5 +1,5 @@
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, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, kernSize = 3, thresh = 0.8, filtSize = 1, winSize = 1024, hopSize = -1, fftSize = -1, action;
//var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize}; //ready for when we need it from the RT wrapper
@ -11,6 +11,11 @@ FluidBufNoveltySlice{
server = server ? Server.default;
server.sendMsg(\cmd, \BufNoveltySlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, kernSize, thresh, filtSize, winSize, hopSize, fftSize);
forkIfNeeded{
server.sendMsg(\cmd, \BufNoveltySlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, kernSize, thresh, filtSize, winSize, hopSize, fftSize);
server.sync;
indBufNum = server.cachedBufferAt(indBufNum); indBufNum.updateInfo; server.sync;
action.value(indBufNum);
};
}
}

@ -1,5 +1,5 @@
FluidBufOnsetSlice{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, function = 0, threshold = 0.1, debounce = 2, filterSize = 5, frameDelta = 0, winSize = 1024, hopSize = -1, fftSize = -1;
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, function = 0, threshold = 0.1, debounce = 2, filterSize = 5, frameDelta = 0, winSize = 1024, hopSize = -1, fftSize = -1, action;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
@ -14,6 +14,11 @@ FluidBufOnsetSlice{
//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, \BufOnsetSlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, function, threshold, debounce, filterSize, frameDelta, winSize, hopSize, fftSize, maxFFTSize);
}
forkIfNeeded{
server.sendMsg(\cmd, \BufOnsetSlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, function, threshold, debounce, filterSize, frameDelta, winSize, hopSize, fftSize, maxFFTSize);
server.sync;
indBufNum = server.cachedBufferAt(indBufNum); indBufNum.updateInfo; server.sync;
action.value(indBufNum);
};
}
}

@ -1,5 +1,5 @@
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, 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, action;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
@ -13,10 +13,15 @@ FluidBufSines{
sineBufNum = sineBufNum ? -1;
resBufNum = resBufNum ? -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, srcBufNum, startAt, nFrames, startChan, nChans, sineBufNum, resBufNum, bw, thresh, minTrackLen, magWeight, freqWeight, winSize, hopSize, fftSize, maxFFTSize);
server.sync;
if (sineBufNum != -1) {sineBufNum = server.cachedBufferAt(sineBufNum); sineBufNum.updateInfo; server.sync;} {sineBufNum = nil};
if (resBufNum != -1) {resBufNum = server.cachedBufferAt(resBufNum); resBufNum.updateInfo;server.sync;} {resBufNum = nil};
action.value(sineBufNum,resBufNum);
};
}
}

@ -1,5 +1,5 @@
FluidBufTransientSlice{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, winSize = 14, debounce = 25, minSlice = 1000;
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, indBufNum, order = 20, blockSize = 256, padSize = 128, skew = 0, threshFwd = 2, threshBack = 1.1, winSize = 14, debounce = 25, minSlice = 1000, action;
srcBufNum = srcBufNum.asUGenInput;
indBufNum = indBufNum.asUGenInput;
@ -9,6 +9,11 @@ FluidBufTransientSlice{
server = server ? Server.default;
server.sendMsg(\cmd, \BufTransientSlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce, minSlice);
forkIfNeeded{
server.sendMsg(\cmd, \BufTransientSlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce, minSlice);
server.sync;
indBufNum = server.cachedBufferAt(indBufNum); indBufNum.updateInfo; server.sync;
action.value(indBufNum);
};
}
}

@ -1,5 +1,5 @@
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, 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, action;
srcBufNum = srcBufNum.asUGenInput;
transBufNum = transBufNum.asUGenInput;
@ -11,6 +11,12 @@ FluidBufTransients {
transBufNum = transBufNum ? -1;
resBufNum = resBufNum ? -1;
server.sendMsg(\cmd, \BufTransients, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, resBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce);
forkIfNeeded{
server.sendMsg(\cmd, \BufTransients, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, resBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce);
server.sync;
if (transBufNum != -1) {transBufNum = server.cachedBufferAt(transBufNum); transBufNum.updateInfo; server.sync;} {transBufNum = nil};
if (resBufNum != -1) {resBufNum = server.cachedBufferAt(resBufNum); resBufNum.updateInfo;server.sync;} {resBufNum = nil};
action.value(transBufNum,resBufNum);
};
}
}

@ -53,6 +53,9 @@ ARGUMENT:: dstStartChan
ARGUMENT:: dstGain
The gain applied to the samples in the region of the destination buffer over which the source is to be copied. The default value of 0. would overwrite completely, and a value of 1.0 would sum the source to the material that was present.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and dstBufNum instance variables have been updated on the client side. The function will be passed dstBufNum as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.

@ -103,10 +103,12 @@ ARGUMENT:: hopSize
ARGUMENT:: fftSize
The inner FFT/IFFT size. It should be at least 4 samples long; at least the size of the window; and a power of 2. Making it larger than the window size provides interpolation in frequency.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [harmBufNum, percBufNum, resBufNum] as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.
Discussion::
HPSS works by using median filters on the spectral magnitudes of a sound. It hinges on a simple modelling assumption that tonal components will tend to yield concentrations of energy across time, spread out in frequency, and percussive components will manifest as concentrations of energy across frequency, spread out in time. By using median filters across time and frequency respectively, we get initial esitmates of the tonal-ness / transient-ness of a point in time and frequency. These are then combined into 'masks' that are applied to the orginal spectral data in order to produce a separation.

@ -105,6 +105,9 @@ ARGUMENT:: winType
ARGUMENT:: randSeed
The NMF process needs to seed its starting point. If specified, the same values will be used. The default of -1 will randomly assign them. (not implemented yet)
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [dstBufNum, dictBufNum, actBufNum] as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.

@ -54,6 +54,9 @@ ARGUMENT:: hopSize
ARGUMENT:: fftSize
The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and indBufNum instance variables have been updated on the client side. The function will be passed indBufNum as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.

@ -66,6 +66,9 @@ ARGUMENT:: hopSize
ARGUMENT:: fftSize
The inner FFT/IFFT size. It should be at least 4 samples long, at least the size of the window, and a power of 2. Making it larger allows an oversampling of the spectral precision.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [sineBufNum, resBufNum] as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.

@ -63,6 +63,9 @@ ARGUMENT:: debounce
ARGUMENT:: minSlice
The minimum duration of a slice in samples.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and indBufNum instance variables have been updated on the client side. The function will be passed indBufNum as an argument.
RETURNS::
Nothing, as the destination buffer is declared in the function call.

@ -68,6 +68,9 @@ ARGUMENT:: winSize
ARGUMENT:: debounce
The window size in sample within which positive detections will be clumped together to avoid overdetecting in time.
ARGUMENT:: action
A Function to be evaluated once the offline process has finished and all Buffer's instance variables have been updated on the client side. The function will be passed [transBufNum, resBufNum] as an argument.
RETURNS::
Nothing, as the various destination buffers are declared in the function call.

Loading…
Cancel
Save