From 94a51997f72940630d08fcb9f176de7d5aa79e97 Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Wed, 8 Dec 2021 11:22:47 +0000 Subject: [PATCH 1/6] created FluidFilesPath and a test file --- release-packaging/Classes/FluidFilesPath.sc | 5 +++++ test/FluidFilesPath_test.scd | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 release-packaging/Classes/FluidFilesPath.sc create mode 100644 test/FluidFilesPath_test.scd diff --git a/release-packaging/Classes/FluidFilesPath.sc b/release-packaging/Classes/FluidFilesPath.sc new file mode 100644 index 0000000..0b03015 --- /dev/null +++ b/release-packaging/Classes/FluidFilesPath.sc @@ -0,0 +1,5 @@ +FluidFilesPath { + *new { + ^"%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname); + } +} \ No newline at end of file diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd new file mode 100644 index 0000000..37addff --- /dev/null +++ b/test/FluidFilesPath_test.scd @@ -0,0 +1,12 @@ +( +s.waitForBoot{ + Routine{ + var path = FluidFilesPath()++"Nicol-LoopE-M.wav"; + var buf = Buffer.read(s,path); + + s.sync; + + buf.play; + }.play; +} +) \ No newline at end of file From c10b87993644635eba2fc59eb1f8c7bce046a7ec Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Wed, 8 Dec 2021 20:22:11 +0000 Subject: [PATCH 2/6] allow for passing the file name in as well --- release-packaging/Classes/FluidFilesPath.sc | 4 +++- test/FluidFilesPath_test.scd | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/release-packaging/Classes/FluidFilesPath.sc b/release-packaging/Classes/FluidFilesPath.sc index 0b03015..7a3c82e 100644 --- a/release-packaging/Classes/FluidFilesPath.sc +++ b/release-packaging/Classes/FluidFilesPath.sc @@ -1,5 +1,7 @@ FluidFilesPath { *new { - ^"%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname); + arg fileName; + fileName = fileName ? ""; + ^("%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); } } \ No newline at end of file diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd index 37addff..585f577 100644 --- a/test/FluidFilesPath_test.scd +++ b/test/FluidFilesPath_test.scd @@ -1,3 +1,10 @@ +( +// should all return the same path: +(FluidFilesPath()++"Nicol-LoopE-M.wav").postln; +FluidFilesPath("Nicol-LoopE-M.wav").postln; +FluidFilesPath("/Nicol-LoopE-M.wav").postln; +) + ( s.waitForBoot{ Routine{ @@ -9,4 +16,17 @@ s.waitForBoot{ buf.play; }.play; } +) + +( +s.waitForBoot{ + Routine{ + var path = FluidFilesPath("Nicol-LoopE-M.wav"); + var buf = Buffer.read(s,path); + + s.sync; + + buf.play; + }.play; +} ) \ No newline at end of file From 3ba5c4bf3e4221daff7132cc9b59d21b5f720ab0 Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Wed, 8 Dec 2021 20:29:26 +0000 Subject: [PATCH 3/6] one extra slash check! --- release-packaging/Classes/FluidFilesPath.sc | 2 +- test/FluidFilesPath_test.scd | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/release-packaging/Classes/FluidFilesPath.sc b/release-packaging/Classes/FluidFilesPath.sc index 7a3c82e..8c62565 100644 --- a/release-packaging/Classes/FluidFilesPath.sc +++ b/release-packaging/Classes/FluidFilesPath.sc @@ -2,6 +2,6 @@ FluidFilesPath { *new { arg fileName; fileName = fileName ? ""; - ^("%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); + ^("%/../AudioFiles".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); } } \ No newline at end of file diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd index 585f577..0640a9f 100644 --- a/test/FluidFilesPath_test.scd +++ b/test/FluidFilesPath_test.scd @@ -1,6 +1,7 @@ ( // should all return the same path: (FluidFilesPath()++"Nicol-LoopE-M.wav").postln; +(FluidFilesPath()+/+"Nicol-LoopE-M.wav").postln; FluidFilesPath("Nicol-LoopE-M.wav").postln; FluidFilesPath("/Nicol-LoopE-M.wav").postln; ) From d296b05db05c44acdd0de1a1eb92fa43baae125a Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Thu, 9 Dec 2021 10:15:27 +0000 Subject: [PATCH 4/6] add section to bottom of nn-->fm for testing with audio files --- ...Predicts FM Params from Audio Analysis.scd | 59 +++++++++++++------ 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/release-packaging/Examples/Guides/Neural Network Predicts FM Params from Audio Analysis.scd b/release-packaging/Examples/Guides/Neural Network Predicts FM Params from Audio Analysis.scd index 6e59b58..8dc3031 100644 --- a/release-packaging/Examples/Guides/Neural Network Predicts FM Params from Audio Analysis.scd +++ b/release-packaging/Examples/Guides/Neural Network Predicts FM Params from Audio Analysis.scd @@ -27,8 +27,8 @@ s.waitForBoot{ var statsWinSl, hidden_tf, batchSize_nb, momentum_nb, learnRate_nb, maxIter_nb, outAct_pum, act_pum; var add_point = { var id = "point-%".format(id_counter); - mfcc_ds.addPoint(id,mfccbuf,{mfcc_ds.print}); - param_ds.addPoint(id,parambuf,{param_ds.print}); + mfcc_ds.addPoint(id,mfccbuf); + param_ds.addPoint(id,parambuf); id_counter = id_counter + 1; }; var train = { @@ -80,6 +80,8 @@ s.waitForBoot{ }); }; + ~in_bus = Bus.audio(s); + s.sync; synth = { @@ -87,7 +89,8 @@ s.waitForBoot{ var params = FluidStats.kr(FluidBufToKr.kr(parambuf),ControlRate.ir * smooth_params * isPredicting)[0]; var msig = SinOsc.ar(params[1],0,params[2] * params[1]); var csig = SinOsc.ar(params[0] + msig); - var sound_in = SoundIn.ar(0); + // var sound_in = SoundIn.ar(0); + var sound_in = In.ar(~in_bus); var analysis_sig, mfccs, trig, mfccbuf_norm, parambuf_norm; csig = BLowPass4.ar(csig,16000); @@ -109,7 +112,7 @@ s.waitForBoot{ SendReply.kr(trig,"/mfccs",mfccs); csig = csig.dup; - csig * Select.kr(isPredicting,[vol.dbamp,Amplitude.kr(sound_in)]); + csig * Select.kr(isPredicting,[vol.dbamp,FluidLoudness.kr(sound_in)[0].dbamp]); }.play; s.sync; @@ -294,28 +297,48 @@ s.waitForBoot{ s.sync; -/* statsWinSl.valueAction_(0.1); - - 100.do{ - var cfreq = exprand(20,20000); - var mfreq = exprand(20,20000); - var index = rrand(0.0,20); - parambuf.setn(0,[cfreq,mfreq,index]); - 0.2.wait; - add_point.value; - 0.05.wait; - };*/ + statsWinSl.valueAction_(0.0); /* 100.do{ - var cfreq = exprand(60,4000); - var mfreq = exprand(60,1000).clip(0,cfreq); + var cfreq = exprand(20,20000); + var mfreq = exprand(20,20000); var index = rrand(0.0,20); parambuf.setn(0,[cfreq,mfreq,index]); 0.2.wait; add_point.value; 0.05.wait; };*/ + 40.do{ + var cfreq = exprand(100.0,1000.0); + var mfreq = exprand(100.0,min(cfreq,500.0)); + var index = rrand(0.0,8.0); + var arr = [cfreq,mfreq,index]; + parambuf.setn(0,arr); + 0.1.wait; + add_point.value; + 0.1.wait; + arr.postln; + param_ds.print; + "\n\n".postln; + }; }.play(AppClock); }; -) \ No newline at end of file +) + +( +Routine{ + //~path = FluidFilesPath("Tremblay-AaS-VoiceQC-B2K.wav"); + ~path = FluidFilesPath("Tremblay-CEL-GlitchyMusicBoxMelo.wav"); + ~test_buf = Buffer.readChannel(s,~path,channels:[0]); + s.sync; + { + var sig = PlayBuf.ar(1,~test_buf,BufRateScale.ir(~test_buf),doneAction:2); + Out.ar(0,sig); + sig; + }.play(outbus:~in_bus); +}.play; +) + +s.record; +s.stopRecording \ No newline at end of file From 490c9995550ee90f84c5050e64204445b4233274 Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Thu, 9 Dec 2021 10:16:34 +0000 Subject: [PATCH 5/6] Revert "one extra slash check!" This reverts commit 3ba5c4bf3e4221daff7132cc9b59d21b5f720ab0. --- release-packaging/Classes/FluidFilesPath.sc | 2 +- test/FluidFilesPath_test.scd | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/release-packaging/Classes/FluidFilesPath.sc b/release-packaging/Classes/FluidFilesPath.sc index 8c62565..7a3c82e 100644 --- a/release-packaging/Classes/FluidFilesPath.sc +++ b/release-packaging/Classes/FluidFilesPath.sc @@ -2,6 +2,6 @@ FluidFilesPath { *new { arg fileName; fileName = fileName ? ""; - ^("%/../AudioFiles".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); + ^("%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName); } } \ No newline at end of file diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd index 0640a9f..585f577 100644 --- a/test/FluidFilesPath_test.scd +++ b/test/FluidFilesPath_test.scd @@ -1,7 +1,6 @@ ( // should all return the same path: (FluidFilesPath()++"Nicol-LoopE-M.wav").postln; -(FluidFilesPath()+/+"Nicol-LoopE-M.wav").postln; FluidFilesPath("Nicol-LoopE-M.wav").postln; FluidFilesPath("/Nicol-LoopE-M.wav").postln; ) From 8cfa7a1e95f21f95133527be5b0e2ca1b1c5369c Mon Sep 17 00:00:00 2001 From: Ted Moore Date: Tue, 14 Dec 2021 00:57:58 +0000 Subject: [PATCH 6/6] FluidFilesPath helpfile --- .../HelpSource/Classes/FluidFilesPath.schelp | 55 +++++++++++++++++++ test/FluidFilesPath_test.scd | 5 +- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 release-packaging/HelpSource/Classes/FluidFilesPath.schelp diff --git a/release-packaging/HelpSource/Classes/FluidFilesPath.schelp b/release-packaging/HelpSource/Classes/FluidFilesPath.schelp new file mode 100644 index 0000000..23bfacc --- /dev/null +++ b/release-packaging/HelpSource/Classes/FluidFilesPath.schelp @@ -0,0 +1,55 @@ +TITLE:: FluidFilesPath +summary:: A convenience class for accessing the audio files provided with the FluCoMa Extension +categories:: Libraries>FluidCorpusManipulation +related:: Classes/FluidLoadFolder + +DESCRIPTION:: + + +CLASSMETHODS:: + +METHOD:: new +Get the path to the "AudioFiles" folder inside the FluCoMa extensions folder. Following this with a ++ "name_Of_The_File-You-Want.wav" will create the path to file you want. + +ARGUMENT:: fileName +Optionally, you may pass in the name of the file you want to use and the *new class method will return the path to that file. + +returns:: The path to the "AudioFiles" folder inside the FluCoMa extensions folder (optionally with provided file name). + +EXAMPLES:: + +code:: +( +// these will return the same path +(FluidFilesPath()++"Nicol-LoopE-M.wav").postln; +FluidFilesPath("Nicol-LoopE-M.wav").postln; +) + +( +// test it one way +s.waitForBoot{ + Routine{ + var path = FluidFilesPath()++"Nicol-LoopE-M.wav"; + var buf = Buffer.read(s,path); + + s.sync; + + buf.play; + }.play; +} +) + +( +// test it another way +s.waitForBoot{ + Routine{ + var path = FluidFilesPath("Nicol-LoopE-M.wav"); + var buf = Buffer.read(s,path); + + s.sync; + + buf.play; + }.play; +} +) +:: diff --git a/test/FluidFilesPath_test.scd b/test/FluidFilesPath_test.scd index 585f577..db380e7 100644 --- a/test/FluidFilesPath_test.scd +++ b/test/FluidFilesPath_test.scd @@ -1,11 +1,11 @@ ( -// should all return the same path: +// these will return the same path (FluidFilesPath()++"Nicol-LoopE-M.wav").postln; FluidFilesPath("Nicol-LoopE-M.wav").postln; -FluidFilesPath("/Nicol-LoopE-M.wav").postln; ) ( +// test it one way s.waitForBoot{ Routine{ var path = FluidFilesPath()++"Nicol-LoopE-M.wav"; @@ -19,6 +19,7 @@ s.waitForBoot{ ) ( +// test it another way s.waitForBoot{ Routine{ var path = FluidFilesPath("Nicol-LoopE-M.wav");