From e663a62e984edb915830935a10cb6fcec6cfc693 Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Mon, 21 Feb 2022 16:48:51 +0000 Subject: [PATCH] added old example files for human testing to tests folder --- test/10a-weighted-MFCCs-comparison.scd | 2 +- test/10b-weighted-pitch-comparison.scd | 2 +- test/12-windowed-clustered-segmentation.scd | 7 +++++-- test/13-massive-parallelisation-example.scd | 4 ++-- test/8c-mlp-regressor-as-dim-redux.scd | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/test/10a-weighted-MFCCs-comparison.scd b/test/10a-weighted-MFCCs-comparison.scd index c14a7b6..38088b7 100644 --- a/test/10a-weighted-MFCCs-comparison.scd +++ b/test/10a-weighted-MFCCs-comparison.scd @@ -11,7 +11,7 @@ ~flatbuf = 4.collect{Buffer.new}; // here we instantiate a loader as per example 0 -~loader = FluidLoadFolder(File.realpath(FluidBufMFCC.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/"); +~loader = FluidLoadFolder(FluidFilesPath()); // here we instantiate a further slicing step as per example 0 ~slicer = FluidSliceCorpus({ |src,start,num,dest| diff --git a/test/10b-weighted-pitch-comparison.scd b/test/10b-weighted-pitch-comparison.scd index a063065..b565666 100644 --- a/test/10b-weighted-pitch-comparison.scd +++ b/test/10b-weighted-pitch-comparison.scd @@ -1,6 +1,6 @@ //load a part of a sound that has 3 clear components: a clear pitch component to start, a noisy pitchless ending and DC offset silence on both ends ( -b = Buffer.read(s,File.realpath(FluidBufPitch.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav",42250,44100); +b = Buffer.read(s,FluidFilesPath("Tremblay-ASWINE-ScratchySynth-M.wav"),42250,44100); ~pitches = Buffer(s); ~stats = Buffer(s); ~loud = Buffer(s); diff --git a/test/12-windowed-clustered-segmentation.scd b/test/12-windowed-clustered-segmentation.scd index e1dd3b0..ac2b8ba 100644 --- a/test/12-windowed-clustered-segmentation.scd +++ b/test/12-windowed-clustered-segmentation.scd @@ -1,5 +1,5 @@ // load a source folder -~loader = FluidLoadFolder(File.realpath(FluidBufMFCC.class.filenameSymbol).dirname.withTrailingSlash ++ "../AudioFiles/"); +~loader = FluidLoadFolder(FluidFilesPath()); ~loader.play; //slightly oversegment with novelty @@ -102,15 +102,18 @@ t = Main.elapsedTime; ( ~windowedFunct = {arg head, winSize, overlap; var nbass = [], assignments = [], tempDict = (); + "windowedFunct".postln; //check the size of everything to not overrun winSize = (~originalslicesarray.size - head).min(winSize); //copy the items to a subdataset from hear winSize.do{|i| + "winSize %\n".postf(i); tempDict.put((i.asString), ~sliceDict["data"][(~orginalkeys[(i+head)]).asString]);//here one could curate which stats to take // "whichslices:%\n".postf(i+head); }; + "sliceDict cols: %\n".postf(~sliceDict["cols"]); ~windowDS.load(Dictionary.newFrom([\cols, ~sliceDict["cols"].asInteger, \data, tempDict]), action: { - // "% - loaded\n".postf(head); + "% - loaded\n".postf(head); //kmeans 2 and retrieve ordered array of class assignations ~kmeans.fitPredict(~windowDS, ~windowLS, action: {|x| diff --git a/test/13-massive-parallelisation-example.scd b/test/13-massive-parallelisation-example.scd index 81b960d..294a041 100644 --- a/test/13-massive-parallelisation-example.scd +++ b/test/13-massive-parallelisation-example.scd @@ -9,7 +9,7 @@ s.reboot //We'll jam together some random flucoma sounds for illustrative purposes //Get some files ( -~audioexamples_path = File.realpath(FluidBufMelBands.class.filenameSymbol).dirname.withTrailingSlash +/+ "../AudioFiles/*.wav"; +~audioexamples_path = FluidFilesPath()+/+"*.wav"; ~allTheSounds = SoundFile.collect(~audioexamples_path); ~testSounds = ~allTheSounds; ~testSounds.do{|f| f.path.postln}; // print out the files that are loaded @@ -224,7 +224,7 @@ fork{ ~stdmels = FluidDataSet(s);//will standardised, pruned mel data ~standardizer = FluidStandardize(s); ~pruner = FluidDataSetQuery(s); -~tree = FluidKDTree(s,numNeighbours:10,lookupDataSet:~slicedata);//we have to supply the lookup data set when we make the tree (boo!) +~tree = FluidKDTree(s,numNeighbours:10);//we have to supply the lookup data set when we make the tree (boo!) ) //Prune, standardize and fit KDTree diff --git a/test/8c-mlp-regressor-as-dim-redux.scd b/test/8c-mlp-regressor-as-dim-redux.scd index 6c59b6e..4d9ee1f 100644 --- a/test/8c-mlp-regressor-as-dim-redux.scd +++ b/test/8c-mlp-regressor-as-dim-redux.scd @@ -4,7 +4,7 @@ s.reboot; ~raw = FluidDataSet(s); ~norm = FluidDataSet(s); ~retrieved = FluidDataSet(s); -~audio = Buffer.read(s,File.realpath(FluidBufMelBands.class.filenameSymbol).dirname +/+ "../AudioFiles/Tremblay-ASWINE-ScratchySynth-M.wav"); +~audio = Buffer.read(s,FluidFilesPath("Tremblay-ASWINE-ScratchySynth-M.wav")); ~melfeatures = Buffer.new(s); ~stats = Buffer.alloc(s, 7, 40); ~datapoint = Buffer.alloc(s, 40);