nix
Owen Green 7 years ago
commit dfa552131a

@ -1,5 +1,7 @@
FluidBufHPSS{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, harmBufNum, percBufNum, resBufNum, harmFiltSize = 17, percFiltSize = 17, modeFlag, htf1 = 0.1, hta1 = 0, htf2 = 0.5, hta2 = 0, ptf1 = 0.1, pta1 = 0, ptf2 = 0.5, pta2 = 0, winSize = 4096, hopSize = 1024, 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;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
@ -8,8 +10,7 @@ FluidBufHPSS{
percBufNum = percBufNum ? -1;
//For wrapped RT clients, send maximal param values as aliases of the ones that are passed
harmFiltSize.postln;
server.sendMsg(\cmd, \BufHPSS, srcBufNum, startAt, nFrames, startChan, nChans, harmBufNum, percBufNum, resBufNum, harmFiltSize,percFiltSize, modeFlag, htf1, hta1, htf2, hta2, ptf1, pta1, ptf2, pta2, winSize, hopSize, fftSize, fftSize,harmFiltSize, percFiltSize);
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);
}
}

@ -1,11 +1,13 @@
FluidBufNoveltySlice{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, transBufNum, kernelSize = 3, thresh = 0.8, filterSize = 0, winSize = 1024, hopSize = 512, fftSize = 2048;
*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;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
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};
if(indBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
server = server ? Server.default;
server.sendMsg(\cmd, \BufNoveltySlice, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, kernelSize, thresh, filterSize, winSize, hopSize, fftSize);
server.sendMsg(\cmd, \BufNoveltySlice, srcBufNum, startAt, nFrames, startChan, nChans, indBufNum, kernSize, thresh, filtSize, winSize, hopSize, maxFFTSize);
}
}

@ -1,5 +1,7 @@
FluidBufSines{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, sineBufNum, resBufNum, bandwidth = 76, thresh = 0.3, minTrackLen = 15, magWeight = 0.1, freqWeight = 1, winSize = 4096, hopSize = 1024, fftSize = 8192;
*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;
var maxFFTSize = if (fftSize == -1) {winSize.nextPowerOfTwo} {fftSize};
if(srcBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
@ -7,9 +9,10 @@ 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, bandwidth, thresh, minTrackLen, magWeight, freqWeight, winSize, hopSize, fftSize, fftSize);
server.sendMsg(\cmd, \BufSines, srcBufNum, startAt, nFrames, startChan, nChans, sineBufNum, resBufNum, bw, thresh, minTrackLen, magWeight, freqWeight, winSize, hopSize, fftSize, maxFFTSize);
}
}

@ -1,5 +1,5 @@
FluidBufTransientSlice{
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, transBufNum, order = 200, blockSize = 2048, padSize = 1024, skew = 0, threshFwd = 3, threshBack = 1.1, winSize = 14, debounce = 25, minSlice = 1000;
*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;
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};

@ -1,5 +1,5 @@
FluidBufTransients {
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, transBufNum, resBufNum, order = 200, blockSize = 2048, padSize = 1024, skew = 0, threshFwd = 3, 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;
if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
@ -12,4 +12,4 @@ FluidBufTransients {
("Res" + resBufNum).postln;
server.sendMsg(\cmd, \BufTransients, srcBufNum, startAt, nFrames, startChan, nChans, transBufNum, resBufNum, order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce);
}
}
}

@ -1,5 +1,5 @@
FluidTransientSlice : UGen {
*ar { arg in = 0, order = 20, blockSize = 256, padSize = 128, skew = 0.0, threshFwd = 3.0, threshBack = 1.1, winSize=14, debounce=25, minSlice = 1000;
*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)
}
}
}

@ -1,6 +1,6 @@
FluidTransients : MultiOutUGen {
*ar { arg in = 0, order = 20, blockSize = 256, padSize = 128, skew = 0.0, threshFwd = 3.0, threshBack = 1.1, winSize=14, debounce=25;
^this.multiNew('audio', in.asAudioRateInput(this), order, blockSize, padSize, skew,threshFwd ,threshBack, winSize,debounce)
*ar { arg in = 0, order = 20, blockSize = 256, padSize = 128, skew = 0.0, threshFwd = 2.0, threshBack = 1.1, winSize=14, debounce=25;
^this.multiNew('audio', in.asAudioRateInput(this), order, blockSize, padSize, skew, threshFwd, threshBack, winSize, debounce)
}
init { arg ... theInputs;
inputs = theInputs;
@ -11,4 +11,4 @@ FluidTransients : MultiOutUGen {
^channels
}
checkInputs { ^this.checkNInputs(1) }
}
}

@ -55,10 +55,10 @@ ARGUMENT:: percBufNum
ARGUMENT:: resBufNum
The index of the buffer where the residual component will be reconstructed in mode 2.
ARGUMENT:: harmFiltSize
ARGUMENT:: hFiltSize
The size, in spectral frames, of the median filter for the harmonic component. Must be an odd number, >= 3.
ARGUMENT:: percFiltSize
ARGUMENT:: pFiltSize
The size, in spectral bins, of the median filter for the percussive component. Must be an odd number, >=3
ARGUMENT:: modeFlag
@ -147,7 +147,7 @@ d.play;
(
Routine{
t = Main.elapsedTime;
FluidBufHPSS.process(s, b.bufnum, harmBufNum: c.bufnum, percBufNum: d.bufnum, resBufNum:e.bufnum, harmFiltSize:31, modeFlag:2, htf1: 0.005, hta1: 7.5, htf2: 0.168, hta2: 7.5, ptf1: 0.004, pta1: 26.5, ptf2: 0.152, pta2: 26.5);
FluidBufHPSS.process(s, b.bufnum, harmBufNum: c.bufnum, percBufNum: d.bufnum, resBufNum:e.bufnum, hFiltSize:31, modeFlag:2, htf1: 0.005, hta1: 7.5, htf2: 0.168, hta2: 7.5, ptf1: 0.004, pta1: 26.5, ptf2: 0.152, pta2: 26.5);
s.sync;
(Main.elapsedTime - t).postln;
}.play

@ -33,16 +33,16 @@ ARGUMENT:: startChan
ARGUMENT:: nChans
For multichannel srcBuf, how many channel should be summed.
ARGUMENT:: transBufNum
ARGUMENT:: indBufNum
The index of the buffer where the indices (in sample) of the estimated starting points of slices will be written. The first and last points are always the boundary points of the analysis.
ARGUMENT:: kernelSize
ARGUMENT:: kernSize
The granularity of the window in which the algorithm looks for change, in samples. A small number will be sensitive to short term changes, and a large number should look for long term changes.
ARGUMENT:: thresh
The normalised threshold, between 0 an 1, on the novelty curve to consider it a segmentation point.
ARGUMENT:: filterSize
ARGUMENT:: filtSize
The size of a smoothing filter that is applied on the novelty curve. A larger filter filter size allows for cleaner cuts on very sharp changes.
ARGUMENT:: winSize
@ -71,7 +71,7 @@ c = Buffer.new(s);
// with basic params
Routine{
t = Main.elapsedTime;
FluidBufNoveltySlice.process(s,b.bufnum, transBufNum: c.bufnum, thresh:0.6);
FluidBufNoveltySlice.process(s,b.bufnum, indBufNum: c.bufnum, thresh:0.6);
s.sync;
(Main.elapsedTime - t).postln;
}.play
@ -105,7 +105,7 @@ c = Buffer.new(s);
)
// process with a given filterSize
FluidBufNoveltySlice.process(s,b.bufnum, transBufNum: c.bufnum, kernelSize:31, thresh:0.35, filterSize:0)
FluidBufNoveltySlice.process(s,b.bufnum, indBufNum: c.bufnum, kernSize:31, thresh:0.35, filtSize:1)
//check the number of slices: it is the number of frames in the transBuf minus the boundary index.
c.query;
@ -124,7 +124,7 @@ c.query;
// change the filterSize in the code above to 4. Then to 8. Listen in between to the differences.
// What's happening? In the first instance (filterSize = 0), the novelty line is jittery and therefore overtriggers on the arpegiated guitar. We also can hear attacks at the end of the segment. Setting the threshold higher (like in the 'Basic Example' pane) misses some more subtle variations.
// What's happening? In the first instance (filterSize = 1), the novelty line is jittery and therefore overtriggers on the arpegiated guitar. We also can hear attacks at the end of the segment. Setting the threshold higher (like in the 'Basic Example' pane) misses some more subtle variations.
// So in the second settings (filterSize = 4), we smooth the novelty line a little, which allows us to catch small differences that are not jittery. It also corrects the ending cutting by the same trick: the averaging of the sharp pick is sliding up, crossing the threshold slightly earlier.

@ -96,6 +96,6 @@ d.query;
d.play;
//nullsumming tests
{(PlayBuf.ar(1,c.bufnum))+(PlayBuf.ar(1,d.bufnum))-(PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
{(PlayBuf.ar(1, c.bufnum)) + (PlayBuf.ar(1,d.bufnum)) - (PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
::

@ -80,7 +80,7 @@ c = Buffer.new(s);
(
Routine{
t = Main.elapsedTime;
FluidBufTransientSlice.process(s,b.bufnum, transBufNum:c.bufnum, order:80, minSlice:4410);
FluidBufTransientSlice.process(s,b.bufnum, transBufNum:c.bufnum);
s.sync;
(Main.elapsedTime - t).postln;
}.play
@ -104,11 +104,11 @@ c.query;
)
// with everything changed to make it much faster
// with everything changed to make it much better, at the cost of computation time (only 10 seconds are processed here)
(
Routine{
t = Main.elapsedTime;
FluidBufTransients.process(s,b.bufnum, 44100, 44100, 0, 0, c.bufnum, d.bufnum, 100, 512,256,1,2,1,12,20,441);
FluidBufTransientSlice.process(s,b.bufnum, 0, 220500, 0, 1, c.bufnum, 200, 2048, 1024, 1, 3, 1, 15, 30, 4410);
s.sync;
(Main.elapsedTime - t).postln;
}.play

@ -91,6 +91,7 @@ Routine{
}.play
);
// wait for the duration to appear in the post window as a cue that the computation is finished
c.query;
c.play;
d.query;
@ -100,11 +101,11 @@ d.play;
{(PlayBuf.ar(1,c.bufnum))+(PlayBuf.ar(1,d.bufnum))+(-1*PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
// with everything changed to make it much faster
// with everything changed to make it much better, at the cost of computation time (only 5 seconds are processed here)
(
Routine{
t = Main.elapsedTime;
FluidBufTransients.process(s,b.bufnum, 0, 88200, 0, 0, c.bufnum, d.bufnum, 100, 512,256,1,2,1,12,20);
FluidBufTransients.process(s,b.bufnum, 0, 220500, 0, 1, c.bufnum, d.bufnum, 200, 2048, 1024, 1, 3, 1, 15, 30);
s.sync;
(Main.elapsedTime - t).postln;
}.play

@ -17,7 +17,7 @@ ARGUMENT:: in
The audio to be processed.
ARGUMENT:: order
The order in samples of the impulse response filter used to model the estimated continuous signal. It is how many previous samples are used by the algorithm to predict the next one as reference for the model. The higher the order, the more accurate is its spectral definition, not unlike fft, improving low frequency resolution, but it differs in that it is not conected to its temporal resolution.
The order in samples of the impulse response filter used to model the estimated continuous signal. It is how many previous samples are used by the algorithm to predict the next one as reference for the model. The higher the order, the more accurate is its spectral definition, not unlike fft, improving low frequency resolution, but it differs in that it is not connected to its temporal resolution.
ARGUMENT:: blockSize
The size in samples of frame on which it the algorithm is operating. High values are more cpu intensive, and also determines the maximum transient size, which will not be allowed to be more than half that lenght in size.
@ -53,11 +53,11 @@ CODE::
//load some sounds
b = Buffer.read(s,File.realpath(FluidTransientSlice.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav");
// basic param (the process add a latency of (blockSize + padding - order) samples
{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidTransientSlice.ar(sig)*0.5, DelayN.ar(sig, 1, ((256 + 128 - 20)/ s.sampleRate))]}.play
// basic param (the process add a latency of (blockSize + padSize - order) samples
{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidTransientSlice.ar(sig) * 0.5, DelayN.ar(sig, 1, ((256 + 128 - 20)/ s.sampleRate))]}.play
// other parameters
{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidTransientSlice.ar(sig,order:80,minSlice:2205)*0.5, DelayN.ar(sig, 1, ((256 + 128 - 80)/ s.sampleRate))]}.play
{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidTransientSlice.ar(sig,order:80,minSlice:2205) * 0.5, DelayN.ar(sig, 1, ((256 + 128 - 80)/ s.sampleRate))]}.play
// more musical trans-trigged autopan
(

@ -56,11 +56,11 @@ CODE::
b = Buffer.read(s,File.realpath(FluidTransients.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav");
// basic parameters
{FluidTransients.ar(PlayBuf.ar(1,b.bufnum,loop:1))}.play
{FluidTransients.ar(PlayBuf.ar(1, b.bufnum, loop:1))}.play
// tweaked parameterss
{FluidTransients.ar(PlayBuf.ar(1,b.bufnum,loop:1),80,threshFwd:MouseX.kr(0,5),threshBack:MouseY.kr(0,2))}.play
{FluidTransients.ar(PlayBuf.ar(1, b.bufnum, loop:1), 80, threshFwd:MouseX.kr(0,5), threshBack:MouseY.kr(0,2))}.play
// null test (the process add a latency of (blockSize + padding - order) samples
{var sig = PlayBuf.ar(1,b.bufnum,loop:1); [FluidTransients.ar(sig).sum - DelayN.ar(sig, 1, ((256 + 128 - 20)/ s.sampleRate))]}.play
{var sig = PlayBuf.ar(1, b.bufnum, loop:1); [FluidTransients.ar(sig).sum - DelayN.ar(sig, 1, ((256 + 128 - 20)/ s.sampleRate))]}.play
::
Loading…
Cancel
Save