prerelease tidy up

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

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

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

@ -8,7 +8,7 @@
~dict.add(\cols -> 10)
//create a dataset, then loading the dictionary
~ds = FluidDataSet.new(s,\simple1data);
~ds = FluidDataSet(s);
~ds.load(~dict)
~ds.print
@ -33,7 +33,7 @@
~dict2.add(\cols -> 1)
// creating a labelset and loading the dictionary
~ls = FluidLabelSet.new(s,\simplelabel);
~ls = FluidLabelSet(s);
~ls.load(~dict2)
~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));
LocalOut.kr( Done.kr(dsWr));
FreeSelf.kr(count - 99);
Poll.kr(trig,count);
Poll.kr(trig,(100-count));
}.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;
// normalize the input

@ -70,7 +70,7 @@ code::
// another solution: minslicelength
(
{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]
}.plot(0.08);
)

@ -89,7 +89,7 @@ d = Dictionary.new;
d.add(\cols -> 1);
d.add(\data -> Dictionary.newFrom(10.collect{|i|[i.asString, [i.asFloat]]}.flatten));
fork{
~ds = FluidDataSet.new(s); s.sync;
~ds = FluidDataSet.new(s);
~ds.load(d); s.sync;
~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
//create 3 datasets
(
~dsA = FluidDataSet.new(s,\joinA);
~dsB = FluidDataSet.new(s,\joinB);
~dsC = FluidDataSet.new(s,\joinC);
~dsA = FluidDataSet(s);
~dsB = FluidDataSet(s);
~dsC = FluidDataSet(s);
)
//feed them items with almost overlaping label lists but with different dimensions

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

@ -52,12 +52,11 @@ code::
s.reboot;
(
fork{
~ds = FluidDataSet.new(s,\kdtree_help_rand2d);
d = Dictionary.with(
*[\cols -> 2,\data -> Dictionary.newFrom(
100.collect{|i| [i, [ 1.0.linrand,1.0.linrand]]}.flatten)]);
s.sync;
~ds.load(d, {~ds.print});
d = Dictionary.with(
*[\cols -> 2,\data -> Dictionary.newFrom(
100.collect{|i| [i, [ 1.0.linrand,1.0.linrand]]}.flatten)]);
~ds = FluidDataSet(s);
~ds.load(d, {~ds.print});
}
)
@ -106,7 +105,7 @@ fork{
)
// 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
(
~tmpbuf = Buffer.loadCollection(s, ~p, 1, {
@ -139,7 +138,7 @@ Routine{
var point = 2.collect{TRand.kr(0,1,trig)};
point.collect{|p,i| BufWr.kr([p],inputBuffer,i)};
~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;
}.play;
}.play;
@ -148,12 +147,11 @@ Routine{
//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
(
~dsL = FluidDataSet.new(s);
fork{
d = Dictionary.with(
*[\cols -> 1,\data -> Dictionary.newFrom(
100.collect{|i| [i, [ i ]]}.flatten)]);
s.sync;
d = Dictionary.with(
*[\cols -> 1,\data -> Dictionary.newFrom(
100.collect{|i| [i, [ i ]]}.flatten)]);
~dsL = FluidDataSet.new(s);
~dsL.load(d, {~dsL.print});
}
)
@ -169,10 +167,9 @@ Routine{
var point = 2.collect{TRand.kr(0,1,trig)};
point.collect{|p,i| BufWr.kr([p],inputBuffer,i)};
~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;
}.play;
}.play;
)
::

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

@ -106,7 +106,7 @@ d = Dictionary.with(
//We should see a single cycle of a chirp
~outputdata.plot;
s.dumpOSC
// single point transform on arbitrary value
~inbuf = Buffer.loadCollection(s,[0.5]);
~regressor.predictPoint(~inbuf,{|x|x.postln;});
@ -115,7 +115,7 @@ s.dumpOSC
subsection:: Server Side Queries
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);
@ -124,7 +124,7 @@ code::
var outputPoint = LocalBuf(1);
BufWr.kr(input,inputPoint,0);
~regressor.kr(trig,inputPoint,outputPoint);
BufRd.kr(1,outputPoint,0);//,"mapped value")
BufRd.kr(1,outputPoint,0);
}.scope
)

@ -1,7 +1,7 @@
TITLE:: FluidMDS
summary:: Dimensionality Reduction with Multidimensional Scaling
categories:: Dimensionality Reduction, Data Processing
related:: Classes/FluidMDS, Classes/FluidDataSet
related:: Classes/FluidPCA, Classes/FluidDataSet
DESCRIPTION::
@ -99,10 +99,10 @@ FluidBufMFCC.process(s,~audio, features: ~mfcc_feature);
dsWr = FluidDataSetWr.kr(~raw, buf: buf, trig: Done.kr(stats),blocking:1);
LocalOut.kr(Done.kr(dsWr));
FreeSelf.kr(count - 99);
Poll.kr(trig,count);
Poll.kr(trig,(100-count));
}.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
//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
(
~audiofile = File.realpath(FluidBufPitch.class.filenameSymbol).dirname +/+ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav";
~raw = FluidDataSet(s,\norm_help_raw);
~norm = FluidDataSet(s,\norm_help_normd);
~raw = FluidDataSet(s);
~norm = FluidDataSet(s);
~pitch_feature = Buffer.new(s);
~stats = Buffer.alloc(s, 7, 2);
~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));
LocalOut.kr( Done.kr(dsWr));
FreeSelf.kr(count - 99);
Poll.kr(trig,count);
Poll.kr(trig,(100 - count));
}.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
//Then apply the PCA in-place on the standardized data

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

@ -223,9 +223,6 @@ w.front;
~standardizer.transformPoint(~sourcePoint,~standed);
~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
// Let's map our learned UMAP dimensions to the controls of a processor

Loading…
Cancel
Save