final tweak on examples

nix
Pierre Alexandre Tremblay 5 years ago
parent 14b3525f2c
commit 36e47f1e88

@ -290,13 +290,15 @@ Routine{
// let's assemble the query
// first let's normalise our target descriptors
~targetPitch = Buffer(s)
~targetLoud = Buffer(s)
~targetMFCC = Buffer(s)
~targetMFCCs = Buffer(s)
~targetMFCCsp = Buffer(s)
~targetTimbre = Buffer(s)
~targetAll= Buffer(s)
(
~targetPitch = Buffer(s);
~targetLoud = Buffer(s);
~targetMFCC = Buffer(s);
~targetMFCCs = Buffer(s);
~targetMFCCsp = Buffer(s);
~targetTimbre = Buffer(s);
~targetAll= Buffer(s);
)
~normL.transformPoint(~flatLoudbuf[0], ~targetLoud) //normalise the loudness (all dims)
~normP.transformPoint(~flatPitchbuf[0], ~targetPitch) //normalise the pitch (all dims)

@ -82,15 +82,18 @@ a = Slider(w, Rect(10, 20, 330, 20))
~query.addRange(0,3);//add some spectral moments
~query.transformJoin(~slicesShapes, ~curated, ~curated);//join in centroids
//optionally standardize in place
~stan.fitTransform(~curated, ~curated);
~curated.print
//retrieve the dataset as dictionary
~curated.dump{|x|~sliceDict = x;};
~originalslicesarray = (~originalindices.flatten ++ ~loader.buffer.numFrames).asSet.asArray.sort
~orginalkeys = Array.newFrom(~slicer.index.keys).sort{|a,b| ~slicer.index[a][\bounds][0]< ~slicer.index[b][\bounds][0]}
//the windowed function
//the windowed function, recursive to deal with sync dependencies
(
~windowedFunct = {arg head, winSize, overlap;
var nbass = [], assignments = [], tempDict = ();
@ -146,25 +149,19 @@ a = Slider(w, Rect(10, 20, 330, 20))
//the job
//test 1 - start at the begining, consider 4 items at a time, make 2 clusters, overlap 1
~newindices = [~originalslicesarray[0]]; ~newkeys = [~orginalkeys[0]];
~windowedFunct.value(0, 4, 1);
//try again with more clusters
//OPTIONAL: try again with more clusters (3) and a wider window (6) and more overlap (2)
~newindices = [~originalslicesarray[0]]; ~newkeys = [~orginalkeys[0]];
~kmeans.numClusters = 3;
~windowedFunct.value(0,6,2);
~newindices.postln;
~newkeys.postln;
~newindices.size;
//compare sizes
~orginalkeys.size
~newkeys.size;
~newindices.last;
~newkeys.last;
~slicer.index[~orginalkeys[0]]
//export to reaper
(
//first create a new file that ends with rpp - it will overwrite if the file exists
@ -220,4 +217,6 @@ if (f.isOpen , {
f.write(">\n");
f.close;
});
)
)
(then open the time-stamped reaper file clusterdslice in the folder tmp)
Loading…
Cancel
Save