BufSines has now proper class declaration and a skeleton of helpfile

nix
Pierre Alexandre Tremblay 7 years ago
parent 54ce464bf8
commit 57bb13fc81

@ -1,14 +1,12 @@
FluidBufSines{
*process { arg server, src, offsetframes = 0, numframes = -1, offsetchans = 0, numchans = -1, sinebuf, resbuf, bandwidth = 76, threshold = 0.7, mintracklen = 15, magweight = 0.1, freqweight = 1, winsize = 4096, hopsize = 1024, fftsize = -1;
server = server ? Server.default;
if(src.bufnum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
server.sendMsg(\cmd, \BufSines, src.bufnum, offsetframes, numframes, offsetchans, numchans,
if( sinebuf.isNil, -1, {sinebuf.bufnum}),
if( resbuf.isNil, -1, {resbuf.bufnum}), bandwidth, threshold, mintracklen, magweight, freqweight, winsize, hopsize, fftsize);
*process { arg server, srcBufNum, startAt = 0, nFrames = -1, startChan = 0, nChans = -1, sineBufNum, resBufNum, bandwidth = 76, threshold = 0.3, minTrackLen = 15, magWeight = 0.1, freqWeight = 1, winSize = 4096, hopSize = 1024, fftSize = 8192;
if(srcBufNum.isNil) {Error("Invalid Buffer").format(thisMethod.name, this.class.name).throw};
server = server ? Server.default;
sineBufNum = sineBufNum ? -1;
resBufNum = resBufNum ? -1;
server.sendMsg(\cmd, \BufSines, srcBufNum, startAt, nFrames, startChan, nChans, sineBufNum, resBufNum, bandwidth, threshold, minTrackLen, magWeight, freqWeight, winSize, hopSize, fftSize);
}
}

@ -1,5 +1,5 @@
TITLE:: FluidBufNMF
summary:: Non-Negative Matrix Factorisation on Spectral Frames
summary:: Buffer-Based Non-Negative Matrix Factorisation on Spectral Frames
categories:: Libraries>FluidDecomposition
related:: Guides/FluCoMa, Guides/FluidDecomposition

@ -1,15 +1,70 @@
s = Server.default;
s.reboot
TITLE:: FluidBufSines
summary:: Buffer-Based Sinusoidal Modelling and Extraction
categories:: Libraries>FluidDecomposition
related:: Guides/FluCoMa, Guides/FluidDecomposition
(
b = Buffer.read(s,"/Users/owen/Desktop/denoise_stn/sources/01-mix.wav");
h = Buffer.new(s,0,1);
n = Buffer.new(s,0,1);
)
DESCRIPTION::
It is part of the Fluid Decomposition Toolkit of the FluCoMa project. footnote::
This was made possible thanks to the FluCoMa project (http://www.flucoma.org/) funded by the European Research Council (https://erc.europa.eu/) under the European Unions Horizon 2020 research and innovation programme (grant agreement No 725899).::
Buffer.new(s)
CLASSMETHODS::
FluidBufSines.process(s,b,0,1-1,0,-1,h,n,15,0.2)
METHOD:: process
(describe method here)
n.play;
h.play;
ARGUMENT:: server
(describe argument here)
ARGUMENT:: srcBufNum
(describe argument here)
ARGUMENT:: startAt
(describe argument here)
ARGUMENT:: nFrames
(describe argument here)
ARGUMENT:: startChan
(describe argument here)
ARGUMENT:: nChans
(describe argument here)
ARGUMENT:: sineBufNum
(describe argument here)
ARGUMENT:: resBufNum
(describe argument here)
ARGUMENT:: bandwidth
(describe argument here)
ARGUMENT:: threshold
(describe argument here)
ARGUMENT:: minTrackLen
(describe argument here)
ARGUMENT:: magWeight
(describe argument here)
ARGUMENT:: freqWeight
(describe argument here)
ARGUMENT:: winSize
(describe argument here)
ARGUMENT:: hopSize
(describe argument here)
ARGUMENT:: fftSize
(describe argument here)
returns:: (describe returnvalue here)
EXAMPLES::
code::
(some example code)
::

@ -1,7 +1,7 @@
TITLE:: FluidBufTransients
summary:: A Non-Real-Time Transient Extractor
summary:: Buffer-Based Transient Extractor
categories:: Libraries>FluidDecomposition
related:: Overviews/FluCoMa
related:: Guides/FluCoMa, Guides/FluidDecomposition
DESCRIPTION::
A non-real-time transient extractor implementing footnote::This was made possible thanks to the FluCoMa project (http://www.flucoma.org/) funded by the European Research Council (https://erc.europa.eu/) under the European Unions Horizon 2020 research and innovation programme (grant agreement No 725899).::
@ -59,11 +59,8 @@ ARGUMENT:: windowSize
ARGUMENT:: debounce
clumps transients within that window size
returns:: (describe returnvalue here)
INSTANCEMETHODS::
returns::
Nothing, as the various destination buffers are declared in the function call.
EXAMPLES::

@ -86,43 +86,52 @@ c.plot;x.plot; y.plot;
}.play
)
// test with stereo input
// test with stereo input (dual mono for best segregation)
Buffer.freeAll(s)
(
b = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav");
c = Buffer.new(s);
x = Buffer.new(s);
y = Buffer.new(s);
~fft_size = 1024;
~frame_size = 512;
~hop_size = 256;
Routine{
b = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/fluid_decomposition/AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav");
c = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/fluid_decomposition/AudioFiles/Tremblay-AaS-AcousticStrums-M.wav");
d = Buffer.new(s);
e = Buffer.new(s);
x = Buffer.new(s);
y = Buffer.new(s);
~fft_size = 1024;
~frame_size = 512;
~hop_size = 256;
s.sync;
FluidBufCompose.process(s,b.bufnum,srcBufNumB:c.bufnum, srcGainB:0.6, dstStartChanB:1, dstBufNum:d.bufnum);
}.play;
)
b.play
d.query
d.play
(
Routine{
t = Main.elapsedTime;
FluidBufNMF.process(s,b.bufnum,0,-1,0,-1,c.bufnum,x.bufnum,0,y.bufnum,0,5,100,0,~frame_size,~hop_size,~fft_size);
FluidBufNMF.process(s,d.bufnum,0,-1,0,-1,e.bufnum,x.bufnum,0,y.bufnum,0,5,100,0,~frame_size,~hop_size,~fft_size);
s.sync;
(Main.elapsedTime - t).postln;
}.play
}.play;
)
e.query
//test a single rank
{PlayBuf.ar(10,c.bufnum,doneAction:2)[9].dup}.play
{PlayBuf.ar(10,e.bufnum,doneAction:2)[9].dup}.play
// play them all across in a sort of upmixed stereo...
{Splay.ar(PlayBuf.ar(10,c.bufnum,doneAction:2))}.play
{Splay.ar(PlayBuf.ar(10,e.bufnum,doneAction:2))}.play
//test process on a segment
Buffer.freeAll(s)
(
b = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav");
d = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav");
b = Buffer.new(s);
c = Buffer.new(s);
d = Buffer.new(s);
)
b.play
@ -130,16 +139,16 @@ b.play
(
Routine{
t = Main.elapsedTime;
FluidBufNMF.process(s,b.bufnum,44100,44100,0,1,c.bufnum,rank:2);
FluidBufNMF.process(s,d.bufnum,44100,44100,0,1,c.bufnum,rank:2);
s.sync;
(Main.elapsedTime - t).postln;
t = Main.elapsedTime;
FluidBufNMF.process(s,b.bufnum,8810,44100,1,1,d.bufnum,rank:2);
FluidBufNMF.process(s,d.bufnum,8810,44100,1,1,b.bufnum,rank:2);
s.sync;
(Main.elapsedTime - t).postln;
}.play
)
c.query
c.play
d.query
d.play
b.query
b.play

@ -3,143 +3,37 @@ s.reboot
// test for efficiency
(
b = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/archives-2017-18/denoise_stn/sources/01-mix.wav");
b = Buffer.read(s,"/Users/pa/Documents/documents@hudd/research/projects/fluid corpus navigation/research/fluid_decomposition/AudioFiles/Tremblay-AaS-SynthTwoVoices-M.wav");
c = Buffer.new(s);
x = Buffer.new(s);
y = Buffer.new(s);
~fft_size = 1024;
~frame_size = 512;
~hop_size = 256;
~which_rank = 0;
d = Buffer.new(s);
)
(
// without sources
// with basic params
Routine{
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum,0,-1,0,-1,nil,x.bufnum,0,y.bufnum,0,5,100,0,~frame_size,~hop_size,~fft_size);
FluidBufSines.process(s, b.bufnum, sineBufNum: c.bufnum, resBufNum:d.bufnum);
s.sync;
(Main.elapsedTime - t).postln;
}.play
);
// with sources only
(
Routine{
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum, 0,-1,0,-1,c.bufnum,nil,0,nil,0,5,100,0,~frame_size,~hop_size,~fft_size);
s.sync;
(Main.elapsedTime - t).postln;
}.play
)
// with everything
(
Routine{
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum, 0,-1,0,-1,c.bufnum,x.bufnum,0,y.bufnum,0,5,100,0,~frame_size,~hop_size,~fft_size);
s.sync;
(Main.elapsedTime - t).postln;
}.play
)
//look at the dictionaries and activations
c.plot;x.plot; y.plot;
//null test of the sum of sources
{(PlayBuf.ar(5,c.bufnum,doneAction:2).sum)+(-1*PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
// play around
{Splay.ar(PlayBuf.ar(5,c.bufnum,doneAction:2))}.play
//play a single source
{PlayBuf.ar(5,c.bufnum,doneAction:2)[~which_rank].dup}.play
//play noise through a filter
(
{
var chain;
chain = FFT(LocalBuf(~fft_size), WhiteNoise.ar());
chain = chain.pvcollect(~fft_size, {|mag, phase, index|
[mag * BufRd.kr(5,x.bufnum,DC.kr(index),0,1)[~which_rank]];
});
IFFT(chain);
}.play
)
//play noise through an activation
{WhiteNoise.ar(BufRd.kr(5,y.bufnum,Phasor.ar(1,1/~hop_size,0,(b.numFrames / ~hop_size + 1)),0,1)[~which_rank])*0.5}.play
//play noise through both activation and filter
(
{
var chain;
chain = FFT(LocalBuf(~fft_size), WhiteNoise.ar(BufRd.kr(5,y.bufnum,Phasor.ar(1,1/~hop_size,0,(b.numFrames / ~hop_size + 1)),0,1)[~which_rank]*12),0.5,1);
chain = chain.pvcollect(~fft_size, {|mag, phase, index|
[mag * BufRd.kr(5,x.bufnum,DC.kr(index),0,1)[~which_rank]];
});
[0,IFFT(chain)];
}.play
)
// test with stereo input
Buffer.freeAll(s)
c.query;
c.play;
d.query;
d.play;
(
b = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav");
c = Buffer.new(s);
x = Buffer.new(s);
y = Buffer.new(s);
~fft_size = 1024;
~frame_size = 512;
~hop_size = 256;
)
//nullsumming tests
{(PlayBuf.ar(1,c.bufnum))+(PlayBuf.ar(1,d.bufnum))+(-1*PlayBuf.ar(1,b.bufnum,doneAction:2))}.play
b.play
// with everything changed to make it much faster
(
Routine{
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum,0,-1,0,-1,c.bufnum,x.bufnum,0,y.bufnum,0,5,100,0,~frame_size,~hop_size,~fft_size);
FluidBufSines.process(s,b.bufnum, 44100, 44100, 0, 0, c.bufnum, d.bufnum, 50,0.2,5,0.2,0.9,2048,512,4096); // need to change these for something sensible
s.sync;
(Main.elapsedTime - t).postln;
}.play
)
//test a single rank
{PlayBuf.ar(10,c.bufnum,doneAction:2)[9].dup}.play
// play them all across in a sort of upmixed stereo...
{Splay.ar(PlayBuf.ar(10,c.bufnum,doneAction:2))}.play
//test process on a segment
Buffer.freeAll(s)
(
b = Buffer.read(s,"/Users/pa/Desktop/verystereo.wav");
c = Buffer.new(s);
d = Buffer.new(s);
)
b.play
);
(
Routine{
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum,44100,44100,0,1,c.bufnum,rank:2);
s.sync;
(Main.elapsedTime - t).postln;
t = Main.elapsedTime;
FDNMF.process(s,b.bufnum,8810,44100,1,1,d.bufnum,rank:2);
s.sync;
(Main.elapsedTime - t).postln;
}.play
)
c.query
c.play
d.query
d.play

Loading…
Cancel
Save