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 // let's assemble the query
// first let's normalise our target descriptors // first let's normalise our target descriptors
~targetPitch = Buffer(s) (
~targetLoud = Buffer(s) ~targetPitch = Buffer(s);
~targetMFCC = Buffer(s) ~targetLoud = Buffer(s);
~targetMFCCs = Buffer(s) ~targetMFCC = Buffer(s);
~targetMFCCsp = Buffer(s) ~targetMFCCs = Buffer(s);
~targetTimbre = Buffer(s) ~targetMFCCsp = Buffer(s);
~targetAll= Buffer(s) ~targetTimbre = Buffer(s);
~targetAll= Buffer(s);
)
~normL.transformPoint(~flatLoudbuf[0], ~targetLoud) //normalise the loudness (all dims) ~normL.transformPoint(~flatLoudbuf[0], ~targetLoud) //normalise the loudness (all dims)
~normP.transformPoint(~flatPitchbuf[0], ~targetPitch) //normalise the pitch (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.addRange(0,3);//add some spectral moments
~query.transformJoin(~slicesShapes, ~curated, ~curated);//join in centroids ~query.transformJoin(~slicesShapes, ~curated, ~curated);//join in centroids
//optionally standardize in place
~stan.fitTransform(~curated, ~curated); ~stan.fitTransform(~curated, ~curated);
~curated.print ~curated.print
//retrieve the dataset as dictionary
~curated.dump{|x|~sliceDict = x;}; ~curated.dump{|x|~sliceDict = x;};
~originalslicesarray = (~originalindices.flatten ++ ~loader.buffer.numFrames).asSet.asArray.sort ~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]} ~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; ~windowedFunct = {arg head, winSize, overlap;
var nbass = [], assignments = [], tempDict = (); var nbass = [], assignments = [], tempDict = ();
@ -146,25 +149,19 @@ a = Slider(w, Rect(10, 20, 330, 20))
//the job //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]]; ~newindices = [~originalslicesarray[0]]; ~newkeys = [~orginalkeys[0]];
~windowedFunct.value(0, 4, 1); ~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]]; ~newindices = [~originalslicesarray[0]]; ~newkeys = [~orginalkeys[0]];
~kmeans.numClusters = 3; ~kmeans.numClusters = 3;
~windowedFunct.value(0,6,2); ~windowedFunct.value(0,6,2);
~newindices.postln; //compare sizes
~newkeys.postln; ~orginalkeys.size
~newindices.size;
~newkeys.size; ~newkeys.size;
~newindices.last;
~newkeys.last;
~slicer.index[~orginalkeys[0]]
//export to reaper //export to reaper
( (
//first create a new file that ends with rpp - it will overwrite if the file exists //first create a new file that ends with rpp - it will overwrite if the file exists
@ -221,3 +218,5 @@ if (f.isOpen , {
f.close; f.close;
}); });
) )
(then open the time-stamped reaper file clusterdslice in the folder tmp)
Loading…
Cancel
Save