noveltyslice and bufhpss updated

nix
Pierre Alexandre Tremblay 7 years ago
parent 4e064bfe56
commit 6a07e0434c

@ -1,5 +1,7 @@
FluidBufHPSS{ 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}; if(srcBufNum.isNil) { Error("Invalid buffer").format(thisMethod.name, this.class.name).throw};
@ -8,8 +10,7 @@ FluidBufHPSS{
percBufNum = percBufNum ? -1; percBufNum = percBufNum ? -1;
//For wrapped RT clients, send maximal param values as aliases of the ones that are passed //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{ 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(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 = 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);
} }
} }

@ -55,10 +55,10 @@ ARGUMENT:: percBufNum
ARGUMENT:: resBufNum ARGUMENT:: resBufNum
The index of the buffer where the residual component will be reconstructed in mode 2. 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. 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 The size, in spectral bins, of the median filter for the percussive component. Must be an odd number, >=3
ARGUMENT:: modeFlag ARGUMENT:: modeFlag
@ -147,7 +147,7 @@ d.play;
( (
Routine{ Routine{
t = Main.elapsedTime; 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; s.sync;
(Main.elapsedTime - t).postln; (Main.elapsedTime - t).postln;
}.play }.play

@ -33,16 +33,16 @@ ARGUMENT:: startChan
ARGUMENT:: nChans ARGUMENT:: nChans
For multichannel srcBuf, how many channel should be summed. 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. 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. 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 ARGUMENT:: thresh
The normalised threshold, between 0 an 1, on the novelty curve to consider it a segmentation point. 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. 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 ARGUMENT:: winSize
@ -71,7 +71,7 @@ c = Buffer.new(s);
// with basic params // with basic params
Routine{ Routine{
t = Main.elapsedTime; 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; s.sync;
(Main.elapsedTime - t).postln; (Main.elapsedTime - t).postln;
}.play }.play
@ -105,7 +105,7 @@ c = Buffer.new(s);
) )
// process with a given filterSize // 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. //check the number of slices: it is the number of frames in the transBuf minus the boundary index.
c.query; 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. // 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. // 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.

Loading…
Cancel
Save