found a bug in the buffer summing of both nmf examples

nix
Pierre Alexandre Tremblay 7 years ago
parent 8dd5a23777
commit 89ceda219b

@ -187,7 +187,7 @@ c.plot;x.plot; y.plot;
CODE:: CODE::
//set some buffers //set some buffers
( (
b = Buffer.read(s,File.realpath(FluidBufNMF.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav"); b = Buffer.read(s,File.realpath(FluidBufNMF.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-AaS-AcousticStrums-M.wav");
c = Buffer.new(s); c = Buffer.new(s);
@ -196,7 +196,7 @@ e = Buffer.alloc(s,1,1);
y = Buffer.alloc(s,1,1); y = Buffer.alloc(s,1,1);
) )
// train only 2 seconds // train only 2 seconds
( (
Routine { Routine {
FluidBufNMF.process(s,b.bufnum,0,88200,0,1, c.bufnum, x.bufnum, rank:10); FluidBufNMF.process(s,b.bufnum,0,88200,0,1, c.bufnum, x.bufnum, rank:10);
@ -207,27 +207,28 @@ Routine {
// find the rank that has the picking sound by changing which channel to listen to // find the rank that has the picking sound by changing which channel to listen to
( (
~element = 0; ~element = 9;
{PlayBuf.ar(10,c.bufnum)[~element]}.play {PlayBuf.ar(10,c.bufnum)[~element]}.play
) )
// copy all the other ranks on itself and the picking dictionnary as the sole component of the 1st channel // copy all the other ranks on itself and the picking dictionnary as the sole component of the 1st channel
( (
Routine{ Routine{
(0..9).remove(~element).do({|chan|FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA:chan, nChansA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum)}); z = (0..9);
s.sync; FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA: z.removeAt(~element), nChansA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum);
e.query; s.sync;
s.sync; e.query;
FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA: ~element, nChansA: 1, srcBufNumB: e.bufnum, dstStartChanB: 1, dstBufNum: e.bufnum); s.sync;
s.sync; z.do({|chan|FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA:chan, nChansA: 1, dstStartChanA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum)});
e.query; s.sync;
e.query;
}.play; }.play;
) )
//process the whole file, splitting it with the 2 trained dictionnaries //process the whole file, splitting it with the 2 trained dictionnaries
( (
Routine{ Routine{
FluidBufNMF.process(s, b.bufnum, dstBufNum: c.bufnum, dictBufNum: e.bufnum, dictFlag: 2, actBufNum:y.bufnum, rank:2); FluidBufNMF.process(s, b.bufnum, dstBufNum: c.bufnum, dictBufNum: e.bufnum, dictFlag: 2, actBufNum: y.bufnum, rank:2);
s.sync; s.sync;
c.query; c.query;
}.play; }.play;

@ -69,23 +69,25 @@ Routine {
// find the rank that has the picking sound by changing which channel to listen to // find the rank that has the picking sound by changing which channel to listen to
( (
~element = 8; ~element = 4;
{PlayBuf.ar(10,c.bufnum)[~element]}.play {PlayBuf.ar(10,c.bufnum)[~element]}.play
) )
// copy all the other ranks on itself and the picking dictionnary as the sole component of the 1st channel // copy all the other ranks on itself and the picking dictionnary as the sole component of the 1st channel
( (
Routine{ Routine{
(0..9).remove(~element).do({|chan|FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA:chan, nChansA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum)}); z = (0..9);
FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA: z.removeAt(~element), nChansA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum);
s.sync; s.sync;
e.query; e.query;
s.sync; s.sync;
FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA: ~element, nChansA: 1, srcBufNumB: e.bufnum, dstStartChanB: 1, dstBufNum: e.bufnum); z.do({|chan|FluidBufCompose.process(s,srcBufNumA: x.bufnum, startChanA:chan, nChansA: 1, dstStartChanA: 1, srcBufNumB: e.bufnum, dstBufNum: e.bufnum)});
s.sync; s.sync;
e.query; e.query;
}.play; }.play;
) )
e.plot e.plot;
//using this trained dictionary we can see the envelop (activations) of each rank //using this trained dictionary we can see the envelop (activations) of each rank
{FluidNMFMatch.kr(PlayBuf.ar(1,b.bufnum),e.bufnum,2,fftSize:2048)}.plot(10); {FluidNMFMatch.kr(PlayBuf.ar(1,b.bufnum),e.bufnum,2,fftSize:2048)}.plot(10);

Loading…
Cancel
Save