From 36e47f1e885d108c8b1b99d1269d9ef2cc08f88d Mon Sep 17 00:00:00 2001 From: Pierre Alexandre Tremblay Date: Tue, 15 Dec 2020 15:57:23 +0000 Subject: [PATCH] final tweak on examples --- .../11-compositing-datasets.scd | 16 +++++++------ .../12-windowed-clustered-segmentation.scd | 23 +++++++++---------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/release-packaging/Examples/dataset/1-learning examples/11-compositing-datasets.scd b/release-packaging/Examples/dataset/1-learning examples/11-compositing-datasets.scd index 8c69f75..9b55fcf 100644 --- a/release-packaging/Examples/dataset/1-learning examples/11-compositing-datasets.scd +++ b/release-packaging/Examples/dataset/1-learning examples/11-compositing-datasets.scd @@ -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) diff --git a/release-packaging/Examples/dataset/1-learning examples/12-windowed-clustered-segmentation.scd b/release-packaging/Examples/dataset/1-learning examples/12-windowed-clustered-segmentation.scd index 2385216..eb7104e 100644 --- a/release-packaging/Examples/dataset/1-learning examples/12-windowed-clustered-segmentation.scd +++ b/release-packaging/Examples/dataset/1-learning examples/12-windowed-clustered-segmentation.scd @@ -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; }); -) \ No newline at end of file +) + +(then open the time-stamped reaper file clusterdslice in the folder tmp) \ No newline at end of file