Merge pull request #44 from flucoma/enhance/FluidFilesPath

created FluidFilesPath and a test file
nix
Ted Moore 4 years ago committed by GitHub
commit 79385e7f9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,7 @@
FluidFilesPath {
*new {
arg fileName;
fileName = fileName ? "";
^("%/../AudioFiles/".format(File.realpath(FluidDataSet.class.filenameSymbol).dirname) +/+ fileName);
}
}

@ -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,9 +297,9 @@ s.waitForBoot{
s.sync;
/* statsWinSl.valueAction_(0.1);
statsWinSl.valueAction_(0.0);
100.do{
/* 100.do{
var cfreq = exprand(20,20000);
var mfreq = exprand(20,20000);
var index = rrand(0.0,20);
@ -305,17 +308,37 @@ s.waitForBoot{
add_point.value;
0.05.wait;
};*/
/* 100.do{
var cfreq = exprand(60,4000);
var mfreq = exprand(60,1000).clip(0,cfreq);
var index = rrand(0.0,20);
parambuf.setn(0,[cfreq,mfreq,index]);
0.2.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.05.wait;
};*/
0.1.wait;
arr.postln;
param_ds.print;
"\n\n".postln;
};
}.play(AppClock);
};
)
(
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

@ -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;
}
)
::

@ -0,0 +1,33 @@
(
// 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;
}
)
Loading…
Cancel
Save