bufNMF: corrected the 'destination' variable to 'resynth'

nix
Pierre Alexandre Tremblay 6 years ago
parent 5cd2ee4111
commit 5ef2cf3924

@ -1,47 +1,47 @@
FluidBufNMF : UGen { FluidBufNMF : UGen {
*new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, doneAction = 0, blocking = 0| *new1 {|rate, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, doneAction = 0, blocking = 0|
source = source.asUGenInput; source = source.asUGenInput;
destination = destination.asUGenInput; resynth = resynth.asUGenInput;
bases = bases.asUGenInput; bases = bases.asUGenInput;
activations = activations.asUGenInput; activations = activations.asUGenInput;
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
destination = destination ? -1; resynth = resynth ? -1;
bases = bases ? -1; bases = bases ? -1;
activations = activations ? -1; activations = activations ? -1;
^super.new1(rate,source, startFrame, numFrames, startChan, numChans, destination, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, doneAction, blocking); ^super.new1(rate,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, doneAction, blocking);
} }
*kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, doneAction = 0| *kr {|source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth, bases, basesMode = 0, activations, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, doneAction = 0|
^this.multiNew(\control,source, startFrame, numFrames, startChan, numChans, destination, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, doneAction); ^this.multiNew(\control,source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components, iterations, windowSize, hopSize, fftSize, doneAction);
} }
*process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action| *process { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
^FluidNRTProcess.new( ^FluidNRTProcess.new(
server, this, action, [destination, bases, activations].select{|x| x!= -1} server, this, action, [resynth, bases, activations].select{|x| x!= -1}
).process( ).process(
source, startFrame, numFrames, startChan, numChans, destination, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
); );
} }
*processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, destination = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action| *processBlocking { |server, source, startFrame = 0, numFrames = -1, startChan = 0, numChans = -1, resynth = -1, bases = -1, basesMode = 0, activations = -1, actMode = 0, components = 1, iterations = 100, windowSize = 1024, hopSize = -1, fftSize = -1, windowType = 0, randomSeed = -1, action|
source.isNil.if {"FluidBufNMF: Invalid source buffer".throw}; source.isNil.if {"FluidBufNMF: Invalid source buffer".throw};
^FluidNRTProcess.new( ^FluidNRTProcess.new(
server, this, action, [destination, bases, activations].select{|x| x!= -1},blocking: 1 server, this, action, [resynth, bases, activations].select{|x| x!= -1},blocking: 1
).process( ).process(
source, startFrame, numFrames, startChan, numChans, destination, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed source, startFrame, numFrames, startChan, numChans, resynth, bases, basesMode, activations, actMode, components,iterations, windowSize, hopSize, fftSize, windowType, randomSeed
); );
} }
} }

@ -59,7 +59,7 @@ ARGUMENT:: startChan
ARGUMENT:: numChans ARGUMENT:: numChans
For multichannel srcBuf, how many channel should be processed. For multichannel srcBuf, how many channel should be processed.
ARGUMENT:: destination ARGUMENT:: resynth
The index of the buffer where the different reconstructed components will be reconstructed. The buffer will be resized to STRONG::components * numChannelsProcessed:: channels and STRONG::sourceDuration:: lenght. If STRONG::nil:: is provided, the reconstruction will not happen. The index of the buffer where the different reconstructed components will be reconstructed. The buffer will be resized to STRONG::components * numChannelsProcessed:: channels and STRONG::sourceDuration:: lenght. If STRONG::nil:: is provided, the reconstruction will not happen.
ARGUMENT:: bases ARGUMENT:: bases
@ -106,7 +106,7 @@ ARGUMENT:: randomSeed
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) 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 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 [destination, bases, activations] as an argument. 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 [resynth, bases, activations] as an argument.
RETURNS:: RETURNS::
Nothing, as the various destination buffers are declared in the function call. Nothing, as the various destination buffers are declared in the function call.
@ -145,7 +145,7 @@ d.play //////(beware !!!! loud!!!)
( (
// separate them in 2 components // separate them in 2 components
Routine { Routine {
FluidBufNMF.process(s, d, destination:e, bases: f, activations:g, components:2); FluidBufNMF.process(s, d, resynth:e, bases: f, activations:g, components:2);
e.query; e.query;
f.query; f.query;
g.query; g.query;
@ -299,7 +299,7 @@ z.do({|chan| FluidBufCompose.process(s, ~bases, startChan:chan, numChans: 1, des
//process the whole file, splitting it with the 2 trained bases //process the whole file, splitting it with the 2 trained bases
( (
Routine{ Routine{
FluidBufNMF.process(s, b, destination: ~sortedNMF, bases: ~trainedBases, basesMode: 2, components:2); FluidBufNMF.process(s, b, resynth: ~sortedNMF, bases: ~trainedBases, basesMode: 2, components:2);
~originalNMF.query; ~originalNMF.query;
}.play; }.play;
) )
@ -357,7 +357,7 @@ e.query
( (
// use the seeding basis, without updating // use the seeding basis, without updating
Routine { Routine {
FluidBufNMF.process(s, d, destination:f, bases: e, basesMode: 2, activations:g, components:3); FluidBufNMF.process(s, d, resynth:f, bases: e, basesMode: 2, activations:g, components:3);
e.query; e.query;
f.query; f.query;
g.query; g.query;
@ -376,7 +376,7 @@ g.plot;
( (
// use the seeding bases, with updating this time // use the seeding bases, with updating this time
Routine { Routine {
FluidBufNMF.process(s, d, destination:f, bases: e, basesMode: 1, activations:g, components:3); FluidBufNMF.process(s, d, resynth:f, bases: e, basesMode: 1, activations:g, components:3);
e.query; e.query;
f.query; f.query;
g.query; g.query;

@ -40,16 +40,16 @@ SynthDef(\playa, { arg output = 0, bufnum = 0;
// instantiate the player // instantiate the player
x = Synth(\playa,[\output, g.index, \bufnum, e.bufnum]); x = Synth(\playa,[\output, g.index, \bufnum, e.bufnum]);
// instantiate the processor // instantiate the processor, please ignore the Buffer UGen warnings
y = Synth(\becauseIcan,[\bufnum, b.bufnum, \nmfa, c.bufnum, \nmfb, d.bufnum, \input, g.index, \env, h.bufnum], x, 'addAfter'); y = Synth(\becauseIcan,[\bufnum, b.bufnum, \nmfa, c.bufnum, \nmfb, d.bufnum, \input, g.index, \env, h.bufnum], x, 'addAfter');
// instantiate the listener to cue the processing from the language side // instantiate the listener to cue the processing from the language side
( (
w = OSCFunc({ arg msg; w = OSCFunc({ arg msg;
if(msg[3]== 1, { if(msg[3]== 1, {
FluidBufNMF.process(s, b, numFrames: 22500, destination: c.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256); FluidBufNMF.process(s, b, numFrames: 22500, resynth: c.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256);
}, { }, {
FluidBufNMF.process(s, b, 22050, 22500, destination: d.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256); FluidBufNMF.process(s, b, 22050, 22500, resynth: d.bufnum, iterations: 3, fftSize: 1024, windowSize: 512, hopSize: 256);
});}, '/processplease', s.addr); });}, '/processplease', s.addr);
) )

Loading…
Cancel
Save