more small tweaks

nix
Pierre Alexandre Tremblay 5 years ago
parent f300a7d196
commit dcc0509cb3

@ -2,10 +2,10 @@
// define a few datasets // define a few datasets
( (
~pitchDS = FluidDataSet(s,\pitch11); ~pitchDS = FluidDataSet(s);
~loudDS = FluidDataSet(s,\loud11); ~loudDS = FluidDataSet(s);
~mfccDS = FluidDataSet(s,\mfcc11); ~mfccDS = FluidDataSet(s);
~durDS = FluidDataSet(s,\dur11); ~durDS = FluidDataSet(s);
//define as many buffers as we have parallel voices/threads in the extractor processing (default is 4) //define as many buffers as we have parallel voices/threads in the extractor processing (default is 4)
~pitchbuf = 4.collect{Buffer.new}; ~pitchbuf = 4.collect{Buffer.new};
@ -102,7 +102,7 @@ t = Main.elapsedTime;
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
//reduce the MFCC timbral space stats (many potential ways to explore here... - 2 are provided to compare, with and without the derivatives before running a dimension reduction) //reduce the MFCC timbral space stats (many potential ways to explore here... - 2 are provided to compare, with and without the derivatives before running a dimension reduction)
~tempDS = FluidDataSet(s,\temp11); ~tempDS = FluidDataSet(s);
~query = FluidDataSetQuery(s); ~query = FluidDataSetQuery(s);
~query.addRange(0,24);//add only means and stddev of the 12 coeffs... ~query.addRange(0,24);//add only means and stddev of the 12 coeffs...
@ -115,12 +115,12 @@ t = Main.elapsedTime;
// standardizing before the PCA, as argued here: // standardizing before the PCA, as argued here:
// https://scikit-learn.org/stable/auto_examples/preprocessing/plot_scaling_importance.html // https://scikit-learn.org/stable/auto_examples/preprocessing/plot_scaling_importance.html
~stan = FluidStandardize(s); ~stan = FluidStandardize(s);
~stanDS = FluidDataSet(s,\stan11); ~stanDS = FluidDataSet(s);
~stan.fitTransform(~tempDS,~stanDS) ~stan.fitTransform(~tempDS,~stanDS)
//shrinking A: using 2 stats on the values, and 2 stats on the redivative (12 x 2 x 2 = 48 dim) //shrinking A: using 2 stats on the values, and 2 stats on the redivative (12 x 2 x 2 = 48 dim)
~pca = FluidPCA(s,4);//shrink to 4 dimensions ~pca = FluidPCA(s,4);//shrink to 4 dimensions
~timbreDSd = FluidDataSet(s,\timbreDSd11); ~timbreDSd = FluidDataSet(s);
~pca.fitTransform(~stanDS,~timbreDSd,{|x|x.postln;})//accuracy ~pca.fitTransform(~stanDS,~timbreDSd,{|x|x.postln;})//accuracy
//shrinking B: using only the 2 stats on the values //shrinking B: using only the 2 stats on the values
@ -133,7 +133,7 @@ t = Main.elapsedTime;
//keep its own PCA so we can keep the various states for later transforms //keep its own PCA so we can keep the various states for later transforms
~pca2 = FluidPCA(s,4);//shrink to 4 dimensions ~pca2 = FluidPCA(s,4);//shrink to 4 dimensions
~timbreDS = FluidDataSet(s,\timbreDS11); ~timbreDS = FluidDataSet(s);
~pca2.fitTransform(~tempDS,~timbreDS,{|x|x.postln;})//accuracy ~pca2.fitTransform(~tempDS,~timbreDS,{|x|x.postln;})//accuracy
// comparing NN for fun // comparing NN for fun
@ -181,7 +181,7 @@ Routine{
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// compositing queries - defining a target and analysing it // compositing queries - defining a target and analysing it
~globalDS = FluidDataSet(s,\global11); ~globalDS = FluidDataSet(s);
// define a source // define a source
~targetsound = Buffer.read(s,File.realpath(FluidBufPitch.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav",42250,44100); ~targetsound = Buffer.read(s,File.realpath(FluidBufPitch.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav",42250,44100);
@ -267,9 +267,9 @@ Routine{
// make sure to define and describe the source above (lines 178 to 201) // make sure to define and describe the source above (lines 178 to 201)
// let's make normalised versions of the 3 datasets, keeping the normalisers separate to query later // let's make normalised versions of the 3 datasets, keeping the normalisers separate to query later
~loudDSn = FluidDataSet(s,\loud11n); ~loudDSn = FluidDataSet(s);
~pitchDSn = FluidDataSet(s,\pitch11n); ~pitchDSn = FluidDataSet(s);
~timbreDSn = FluidDataSet(s,\timbre11n); ~timbreDSn = FluidDataSet(s);
~normL = FluidNormalize(s) ~normL = FluidNormalize(s)
~normP = FluidNormalize(s) ~normP = FluidNormalize(s)

@ -1,10 +1,10 @@
// load a source folder // load a source folder
~loader = FluidLoadFolder("/Volumes/machins/projets/newsfeed/sons/textes/Audio/synth"); ~loader = FluidLoadFolder(File.realpath(FluidBufPitch.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/");
~loader.play; ~loader.play;
//slightly oversegment with novelty //slightly oversegment with novelty
//segments should still make sense but might cut a few elements in 2 or 3 //segments should still make sense but might cut a few elements in 2 or 3
~slicer = FluidSliceCorpus({ |src,start,num,dest| FluidBufNoveltySlice.kr(src,start,num,indices:dest, feature: 1, kernelSize: 29, threshold: 0.05, filterSize: 5, hopSize: 128)}); ~slicer = FluidSliceCorpus({ |src,start,num,dest| FluidBufNoveltySlice.kr(src,start,num,indices:dest, feature: 1, kernelSize: 29, threshold: 0.1, filterSize: 5, hopSize: 128)});
~slicer.play(s, ~loader.buffer,~loader.index); ~slicer.play(s, ~loader.buffer,~loader.index);
//test the segmentation by looping them //test the segmentation by looping them
@ -14,7 +14,7 @@ d = {arg start=0, end = 44100;
BufRd.ar(1, ~loader.buffer, Phasor.ar(0,1,start,end,start),0,1); BufRd.ar(1, ~loader.buffer, Phasor.ar(0,1,start,end,start),0,1);
}.play; }.play;
w = Window.new.front; w = Window.new(bounds:Rect(100,100,400,60)).front;
b = ControlSpec(0, ~originalindices.size - 1, \linear, 1); // min, max, mapping, step b = ControlSpec(0, ~originalindices.size - 1, \linear, 1); // min, max, mapping, step
c = StaticText(w, Rect(340, 20, 50, 20)).align_(\center); c = StaticText(w, Rect(340, 20, 50, 20)).align_(\center);
a = Slider(w, Rect(10, 20, 330, 20)) a = Slider(w, Rect(10, 20, 330, 20))
@ -29,8 +29,8 @@ a = Slider(w, Rect(10, 20, 330, 20))
~featuresbuf = 4.collect{Buffer.new}; ~featuresbuf = 4.collect{Buffer.new};
~statsbuf = 4.collect{Buffer.new}; ~statsbuf = 4.collect{Buffer.new};
~flatbuf = 4.collect{Buffer.new}; ~flatbuf = 4.collect{Buffer.new};
~slicesMFCC = FluidDataSet(s,\slicesM); ~slicesMFCC = FluidDataSet(s);
~slicesShapes = FluidDataSet(s,\slicesS); ~slicesShapes = FluidDataSet(s);
~extractor = FluidProcessSlices({|src,start,num,data| ~extractor = FluidProcessSlices({|src,start,num,data|
var features, stats, writer, flatten,mfccBuf, statsBuf, flatBuf, label, voice; var features, stats, writer, flatten,mfccBuf, statsBuf, flatBuf, label, voice;
label = data.key; label = data.key;
@ -54,12 +54,12 @@ a = Slider(w, Rect(10, 20, 330, 20))
//we overlap the analysis with the last (original) slice to check for continuity //we overlap the analysis with the last (original) slice to check for continuity
( (
~winSize = 4;//the number of consecutive items to split in 2 classes; ~winSize = 4;//the number of consecutive items to split in 2 classes;
~curated = FluidDataSet(s,\curatedDS); ~curated = FluidDataSet(s);
~query = FluidDataSetQuery(s); ~query = FluidDataSetQuery(s);
~stan = FluidStandardize(s); ~stan = FluidStandardize(s);
~kmeans = FluidKMeans(s,2,1000); ~kmeans = FluidKMeans(s,2,1000);
~windowDS = FluidDataSet(s,\windowDS); ~windowDS = FluidDataSet(s);
~windowLS = FluidLabelSet(s,\windowLS); ~windowLS = FluidLabelSet(s);
) )
//curate stats (MFCCs) //curate stats (MFCCs)

@ -12,14 +12,14 @@
~query = FluidDataSetQuery(s); ~query = FluidDataSetQuery(s);
~stan = FluidStandardize(s); ~stan = FluidStandardize(s);
~norm = FluidNormalize(s); ~norm = FluidNormalize(s);
~sourceR = FluidDataSet(s,\a3DsourceR); ~sourceR = FluidDataSet(s);
~sourceG = FluidDataSet(s,\a3DsourceG); ~sourceG = FluidDataSet(s);
~sourceB = FluidDataSet(s,\a3DsourceB); ~sourceB = FluidDataSet(s);
~scaledR = FluidDataSet(s,\a3DscaledR); ~scaledR = FluidDataSet(s);
~scaledG = FluidDataSet(s,\a3DscaledG); ~scaledG = FluidDataSet(s);
~scaledB = FluidDataSet(s,\a3DscaledB); ~scaledB = FluidDataSet(s);
~composited = FluidDataSet(s,\a3Dcomposited); ~composited = FluidDataSet(s);
~labels = FluidLabelSet(s,\a3Dlabels); ~labels = FluidLabelSet(s);
) )
//Make some random, but clustered test points, each descriptor category in a separate dataset //Make some random, but clustered test points, each descriptor category in a separate dataset
@ -81,7 +81,7 @@ w.front;
//Visualise: //Visualise:
( (
w = Window("stanClasses", Rect(128, 64, 820, 120)); w = Window("stanClasses", Rect(128, 204, 820, 120));
w.drawFunc = { w.drawFunc = {
Pen.use{ Pen.use{
~compodict2["data"].keysValuesDo{|key, colour| ~compodict2["data"].keysValuesDo{|key, colour|
@ -115,7 +115,7 @@ w.front;
//Visualise: //Visualise:
( (
w = Window("normClasses", Rect(128, 64, 820, 120)); w = Window("normClasses", Rect(128, 344, 820, 120));
w.drawFunc = { w.drawFunc = {
Pen.use{ Pen.use{
~compodict2["data"].keysValuesDo{|key, colour| ~compodict2["data"].keysValuesDo{|key, colour|
@ -147,7 +147,7 @@ w.front;
//Visualise: //Visualise:
( (
w = Window("norm10rClasses", Rect(128, 64, 820, 120)); w = Window("norm10rClasses", Rect(128, 484, 820, 120));
w.drawFunc = { w.drawFunc = {
Pen.use{ Pen.use{
~compodict2["data"].keysValuesDo{|key, colour| ~compodict2["data"].keysValuesDo{|key, colour|

Loading…
Cancel
Save