prerelease tidy up

nix
Pierre Alexandre Tremblay 5 years ago
parent 5cbe109c93
commit 20e718668f

@ -43,7 +43,7 @@ Routine{
}.play }.play
) )
~labels = FluidLabelSet(s,\simple1label); ~labels = FluidLabelSet(s);
~kmeans.predict(~ds,~labels, {|x| ("Size of each cluster" + x).postln}) ~kmeans.predict(~ds,~labels, {|x| ("Size of each cluster" + x).postln})

@ -47,7 +47,7 @@ Routine{
}.play }.play
) )
~labels = FluidLabelSet(s,\simple1label); ~labels = FluidLabelSet(s);
~kmeans.predict(~ds,~labels, {|x| ("Size of each cluster" + x).postln}) ~kmeans.predict(~ds,~labels, {|x| ("Size of each cluster" + x).postln})

@ -8,7 +8,7 @@
~dict.add(\cols -> 10) ~dict.add(\cols -> 10)
//create a dataset, then loading the dictionary //create a dataset, then loading the dictionary
~ds = FluidDataSet.new(s,\simple1data); ~ds = FluidDataSet(s);
~ds.load(~dict) ~ds.load(~dict)
~ds.print ~ds.print
@ -33,7 +33,7 @@
~dict2.add(\cols -> 1) ~dict2.add(\cols -> 1)
// creating a labelset and loading the dictionary // creating a labelset and loading the dictionary
~ls = FluidLabelSet.new(s,\simplelabel); ~ls = FluidLabelSet(s);
~ls.load(~dict2) ~ls.load(~dict2)
~ls.print ~ls.print

@ -34,10 +34,10 @@ FluidBufMelBands.process(s,~audio, features: ~melfeatures,action: {\done.postln;
dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats)); dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats));
LocalOut.kr( Done.kr(dsWr)); LocalOut.kr( Done.kr(dsWr));
FreeSelf.kr(count - 99); FreeSelf.kr(count - 99);
Poll.kr(trig,count); Poll.kr(trig,(100-count));
}.play; }.play;
) )
// wait for the post window to acknoledge the job is done. Check the dataset if curious (loads of small numbers) // wait for the count to reaches 0 in the post window. Check the dataset if curious (loads of small numbers)
~raw.print; ~raw.print;
// normalize the input // normalize the input

@ -70,7 +70,7 @@ code::
// another solution: minslicelength // another solution: minslicelength
( (
{var env, source = SinOsc.ar(320,0,LFSaw.ar(20, 0, -0.4, 0.6)); {var env, source = SinOsc.ar(320,0,LFSaw.ar(20, 0, -0.4, 0.6));
env = FluidAmpSlice.ar(source,fastRampUp: 5,fastRampDown: 50,slowRampUp: 220,slowRampDown: 220, onThreshold: 10, offThreshold: 7,floor: -60, minSliceLength: 220); env = FluidAmpSlice.ar(source,fastRampUp: 5,fastRampDown: 50,slowRampUp: 220,slowRampDown: 220, onThreshold: 10, offThreshold: 7,floor: -60, minSliceLength: 441);
[source, env] [source, env]
}.plot(0.08); }.plot(0.08);
) )

@ -89,7 +89,7 @@ d = Dictionary.new;
d.add(\cols -> 1); d.add(\cols -> 1);
d.add(\data -> Dictionary.newFrom(10.collect{|i|[i.asString, [i.asFloat]]}.flatten)); d.add(\data -> Dictionary.newFrom(10.collect{|i|[i.asString, [i.asFloat]]}.flatten));
fork{ fork{
~ds = FluidDataSet.new(s); s.sync; ~ds = FluidDataSet.new(s);
~ds.load(d); s.sync; ~ds.load(d); s.sync;
~ds.dump; s.sync; ~ds.free; ~ds.dump; s.sync; ~ds.free;
} }

@ -160,9 +160,9 @@ code::
//this is how to join 2 datasets, adding columns to items with the same label //this is how to join 2 datasets, adding columns to items with the same label
//create 3 datasets //create 3 datasets
( (
~dsA = FluidDataSet.new(s,\joinA); ~dsA = FluidDataSet(s);
~dsB = FluidDataSet.new(s,\joinB); ~dsB = FluidDataSet(s);
~dsC = FluidDataSet.new(s,\joinC); ~dsC = FluidDataSet(s);
) )
//feed them items with almost overlaping label lists but with different dimensions //feed them items with almost overlaping label lists but with different dimensions

@ -45,7 +45,7 @@ EXAMPLES::
code:: code::
s.reboot; s.reboot;
( (
~ds = FluidDataSet(s,\FluidDataSetWr); ~ds = FluidDataSet(s);
) )
( (

@ -52,12 +52,11 @@ code::
s.reboot; s.reboot;
( (
fork{ fork{
~ds = FluidDataSet.new(s,\kdtree_help_rand2d); d = Dictionary.with(
d = Dictionary.with( *[\cols -> 2,\data -> Dictionary.newFrom(
*[\cols -> 2,\data -> Dictionary.newFrom( 100.collect{|i| [i, [ 1.0.linrand,1.0.linrand]]}.flatten)]);
100.collect{|i| [i, [ 1.0.linrand,1.0.linrand]]}.flatten)]); ~ds = FluidDataSet(s);
s.sync; ~ds.load(d, {~ds.print});
~ds.load(d, {~ds.print});
} }
) )
@ -106,7 +105,7 @@ fork{
) )
// enter a valid radius. // enter a valid radius.
~tree.radius = 0.05; ~tree.radius = 0.1;
// FluidKDTree will return only values that are within that radius, up to numNeighbours values // FluidKDTree will return only values that are within that radius, up to numNeighbours values
( (
~tmpbuf = Buffer.loadCollection(s, ~p, 1, { ~tmpbuf = Buffer.loadCollection(s, ~p, 1, {
@ -139,7 +138,7 @@ Routine{
var point = 2.collect{TRand.kr(0,1,trig)}; var point = 2.collect{TRand.kr(0,1,trig)};
point.collect{|p,i| BufWr.kr([p],inputBuffer,i)}; point.collect{|p,i| BufWr.kr([p],inputBuffer,i)};
~tree.kr(trig,inputBuffer,outputBuffer,5,nil); ~tree.kr(trig,inputBuffer,outputBuffer,5,nil);
Poll.kr(trig, BufRd.kr(1,outputBuffer,Array.iota(5)),5.collect{|i| "Neighbour" + i}); Poll.kr(trig, BufRd.kr(1,outputBuffer,Array.iota(10)),10.collect{|i| "Neighbour" + (i/2).asInteger ++ "-" ++ (i.mod(2))});
Silent.ar; Silent.ar;
}.play; }.play;
}.play; }.play;
@ -148,12 +147,11 @@ Routine{
//Using a lookup data set instead: //Using a lookup data set instead:
//here we populate with numbers that are in effect the indicies, but it could be anything numerical that will be returned on the server-side and would be usable on that side //here we populate with numbers that are in effect the indicies, but it could be anything numerical that will be returned on the server-side and would be usable on that side
( (
~dsL = FluidDataSet.new(s);
fork{ fork{
d = Dictionary.with( d = Dictionary.with(
*[\cols -> 1,\data -> Dictionary.newFrom( *[\cols -> 1,\data -> Dictionary.newFrom(
100.collect{|i| [i, [ i ]]}.flatten)]); 100.collect{|i| [i, [ i ]]}.flatten)]);
s.sync; ~dsL = FluidDataSet.new(s);
~dsL.load(d, {~dsL.print}); ~dsL.load(d, {~dsL.print});
} }
) )
@ -169,10 +167,9 @@ Routine{
var point = 2.collect{TRand.kr(0,1,trig)}; var point = 2.collect{TRand.kr(0,1,trig)};
point.collect{|p,i| BufWr.kr([p],inputBuffer,i)}; point.collect{|p,i| BufWr.kr([p],inputBuffer,i)};
~tree.kr(trig,inputBuffer,outputBuffer,5,~dsL); ~tree.kr(trig,inputBuffer,outputBuffer,5,~dsL);
Poll.kr(trig, BufRd.kr(1,outputBuffer,Array.iota(5)),5.collect{|i| "Neighbour" + i}); Poll.kr(trig, BufRd.kr(1,outputBuffer,Array.iota(5)),5.collect{|i| "Neighbour" + i});
Silent.ar; Silent.ar;
}.play; }.play;
}.play; }.play;
) )
:: ::

@ -75,7 +75,7 @@ code::
64.collect{(1.sum3rand) + [1,-1].choose}.clump(2) 64.collect{(1.sum3rand) + [1,-1].choose}.clump(2)
}).flatten(1) * 0.5; }).flatten(1) * 0.5;
fork{ fork{
~dataSet = FluidDataSet.new(s,\kmeans_help_rand2d); ~dataSet = FluidDataSet(s);
d = Dictionary.with( d = Dictionary.with(
*[\cols -> 2,\data -> Dictionary.newFrom( *[\cols -> 2,\data -> Dictionary.newFrom(
~points.collect{|x, i| [i, x]}.flatten)]); ~points.collect{|x, i| [i, x]}.flatten)]);

@ -106,7 +106,7 @@ d = Dictionary.with(
//We should see a single cycle of a chirp //We should see a single cycle of a chirp
~outputdata.plot; ~outputdata.plot;
s.dumpOSC
// single point transform on arbitrary value // single point transform on arbitrary value
~inbuf = Buffer.loadCollection(s,[0.5]); ~inbuf = Buffer.loadCollection(s,[0.5]);
~regressor.predictPoint(~inbuf,{|x|x.postln;}); ~regressor.predictPoint(~inbuf,{|x|x.postln;});
@ -115,7 +115,7 @@ s.dumpOSC
subsection:: Server Side Queries subsection:: Server Side Queries
code:: code::
//Setup //we are here querying with a saw in control rate, all on the server, via a buffer interface
( (
{ {
var input = Saw.kr(2).linlin(-1,1,0,1); var input = Saw.kr(2).linlin(-1,1,0,1);
@ -124,7 +124,7 @@ code::
var outputPoint = LocalBuf(1); var outputPoint = LocalBuf(1);
BufWr.kr(input,inputPoint,0); BufWr.kr(input,inputPoint,0);
~regressor.kr(trig,inputPoint,outputPoint); ~regressor.kr(trig,inputPoint,outputPoint);
BufRd.kr(1,outputPoint,0);//,"mapped value") BufRd.kr(1,outputPoint,0);
}.scope }.scope
) )

@ -1,7 +1,7 @@
TITLE:: FluidMDS TITLE:: FluidMDS
summary:: Dimensionality Reduction with Multidimensional Scaling summary:: Dimensionality Reduction with Multidimensional Scaling
categories:: Dimensionality Reduction, Data Processing categories:: Dimensionality Reduction, Data Processing
related:: Classes/FluidMDS, Classes/FluidDataSet related:: Classes/FluidPCA, Classes/FluidDataSet
DESCRIPTION:: DESCRIPTION::
@ -99,10 +99,10 @@ FluidBufMFCC.process(s,~audio, features: ~mfcc_feature);
dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats),blocking:1); dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats),blocking:1);
LocalOut.kr(Done.kr(dsWr)); LocalOut.kr(Done.kr(dsWr));
FreeSelf.kr(count - 99); FreeSelf.kr(count - 99);
Poll.kr(trig,count); Poll.kr(trig,(100-count));
}.play; }.play;
) )
// wait for the post window to acknoledge the job is done. // wait for the count to reaches 0 in the post window.
//First standardize our DataSet, so that the MFCC dimensions are on comensurate scales //First standardize our DataSet, so that the MFCC dimensions are on comensurate scales
//Then apply the MDS in-place on the standardized data to get 2 dimensions, using a Euclidean distance metric //Then apply the MDS in-place on the standardized data to get 2 dimensions, using a Euclidean distance metric

@ -69,8 +69,8 @@ s.boot;
// FluidNormalize.dumpAllMethods // FluidNormalize.dumpAllMethods
( (
~audiofile = File.realpath(FluidBufPitch.class.filenameSymbol).dirname +/+ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav"; ~audiofile = File.realpath(FluidBufPitch.class.filenameSymbol).dirname +/+ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav";
~raw = FluidDataSet(s,\norm_help_raw); ~raw = FluidDataSet(s);
~norm = FluidDataSet(s,\norm_help_normd); ~norm = FluidDataSet(s);
~pitch_feature = Buffer.new(s); ~pitch_feature = Buffer.new(s);
~stats = Buffer.alloc(s, 7, 2); ~stats = Buffer.alloc(s, 7, 2);
~normalizer = FluidNormalize(s); ~normalizer = FluidNormalize(s);

@ -102,10 +102,10 @@ FluidBufMFCC.process(s,~audio, features: ~mfcc_feature,action:{"Done MFCCs".post
dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats)); dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats));
LocalOut.kr( Done.kr(dsWr)); LocalOut.kr( Done.kr(dsWr));
FreeSelf.kr(count - 99); FreeSelf.kr(count - 99);
Poll.kr(trig,count); Poll.kr(trig,(100 - count));
}.play; }.play;
) )
// wait for the post window to acknoledge the job is done. // wait for the count to reaches 0 in the post window.
//First standardize our DataSet, so that the MFCC dimensions are on comensurate scales //First standardize our DataSet, so that the MFCC dimensions are on comensurate scales
//Then apply the PCA in-place on the standardized data //Then apply the PCA in-place on the standardized data

@ -93,7 +93,7 @@ s.reboot;
~slicer = FluidSliceCorpus({ |src,start,num,dest| ~slicer = FluidSliceCorpus({ |src,start,num,dest|
FluidBufOnsetSlice.kr(src,start,num,indices:dest, threshold:2) FluidBufOnsetSlice.kr(src,start,num,indices:dest, threshold:2)
}); });
~pitchdata = FluidDataSet(s,\FluidProcessSlicesHelp); ~pitchdata = FluidDataSet(s);
~pitchbufs = 4.collect{Buffer.new}; ~pitchbufs = 4.collect{Buffer.new};
~statsbufs = 4.collect{Buffer.new}; ~statsbufs = 4.collect{Buffer.new};
) )

@ -223,9 +223,6 @@ w.front;
~standardizer.transformPoint(~sourcePoint,~standed); ~standardizer.transformPoint(~sourcePoint,~standed);
~umap.transformPoint(~standed, ~umaped, {~umaped.getn(0,2,{|x|x.postln})}) ~umap.transformPoint(~standed, ~umaped, {~umaped.getn(0,2,{|x|x.postln})})
//poking at the data structure within
~umap.dump{|x|x.keys.do{|i|"%: %\n".postf(i,x[i]);}}
// one can also retrieve in control rate with Server Side Queries // one can also retrieve in control rate with Server Side Queries
// Let's map our learned UMAP dimensions to the controls of a processor // Let's map our learned UMAP dimensions to the controls of a processor

Loading…
Cancel
Save