diff --git a/release-packaging/Examples/dataset/1-learning examples/4-regressor-example.scd b/release-packaging/Examples/dataset/1-learning examples/4-regressor-example.scd index 2d6b92d..e7f2b38 100644 --- a/release-packaging/Examples/dataset/1-learning examples/4-regressor-example.scd +++ b/release-packaging/Examples/dataset/1-learning examples/4-regressor-example.scd @@ -57,3 +57,18 @@ Routine{ // look at the interpolated values ~mappingresult.plot + +// change the number of neighbours to regress on +~knn.numNeighbours_(5) +~knn.fit(~simpleInput, ~simpleOutput, action:{"fitting done".postln}) + +// instead of doing the mapping per point, let's do a dataset of 512 points +~target = FluidDataSet(s) +~target.load(Dictionary.newFrom([\cols, 1, \data, Dictionary.newFrom(512.collect{|i|[i.asString, [i.asFloat * 61]]}.flatten)])) +~regressed = FluidDataSet(s) +~knn.predict(~target, ~regressed, action:{"prediction done".postln}) + +//dump the regressed values +~outputArray = Array.newClear(512); +~regressed.dump{|x| x["data"].keysValuesDo{|key,val|~outputArray[key.asInteger] = val[0]}} +~outputArray.plot \ No newline at end of file diff --git a/release-packaging/HelpSource/Classes/FluidAmpGate.schelp b/release-packaging/HelpSource/Classes/FluidAmpGate.schelp index 8fdee5f..2f61f63 100644 --- a/release-packaging/HelpSource/Classes/FluidAmpGate.schelp +++ b/release-packaging/HelpSource/Classes/FluidAmpGate.schelp @@ -60,63 +60,63 @@ RETURNS:: EXAMPLES:: code:: -//basic tests: absThresh sanity +//basic tests: threshold sanity ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12); [source, env] }.plot(0.1); ) -//basic tests: absThresh hysteresis +//basic tests: threshold hysteresis ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -16); [source, env] }.plot(0.1); ) -//basic tests: absThresh min slice +//basic tests: threshold min slice ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minSliceLength:441); [source, env] }.plot(0.1); ) -//basic tests: absThresh min silence +//basic tests: threshold min silence ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minSilenceLength:441); [source, env] }.plot(0.1); ) -//mid tests: absThresh time hysteresis on +//mid tests: threshold time hysteresis on ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minLengthAbove:441); [DelayN.ar(source,0.1,441/44100), env] }.plot(0.1); ) -//mid tests: absThresh time hysteresis off +//mid tests: threshold time hysteresis off ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minLengthBelow:441); [DelayN.ar(source,0.1,441/44100), env] }.plot(0.1); ) -//mid tests: absThresh with lookBack +//mid tests: threshold with lookBack ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookBack:441); [DelayN.ar(source,0.1,441/44100), env] }.plot(0.1); ) -//mid tests: absThresh with lookAhead +//mid tests: threshold with lookAhead ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookAhead:441); [DelayN.ar(source,0.1,441/44100), env] }.plot(0.1); ) -//mid tests: absThresh with asymetrical lookBack and lookAhead +//mid tests: threshold with asymetrical lookBack and lookAhead ( {var env, source = SinOsc.ar(320,0,LFTri.ar(10).abs); env = FluidAmpGate.ar(source, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookBack:221, lookAhead:441); diff --git a/release-packaging/HelpSource/Classes/FluidBufAmpGate.schelp b/release-packaging/HelpSource/Classes/FluidBufAmpGate.schelp index b2add49..c654ee6 100644 --- a/release-packaging/HelpSource/Classes/FluidBufAmpGate.schelp +++ b/release-packaging/HelpSource/Classes/FluidBufAmpGate.schelp @@ -91,47 +91,47 @@ code:: ) b.play b.plot -//basic tests: absThresh sanity +//basic tests: threshold sanity FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//basic tests: absThresh hysteresis +//basic tests: threshold hysteresis FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -16) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//basic tests: absThresh min slice +//basic tests: threshold min slice FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minSliceLength:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//basic tests: absThresh min silence +//basic tests: threshold min silence FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minSilenceLength:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//mid tests: absThresh time hysteresis on +//mid tests: threshold time hysteresis on FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minLengthAbove:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//mid tests: absThresh time hysteresis off +//mid tests: threshold time hysteresis off FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, minLengthBelow:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//mid tests: absThresh with lookBack +//mid tests: threshold with lookBack FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookBack:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//mid tests: absThresh with lookAhead +//mid tests: threshold with lookAhead FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookAhead:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;}) -//mid tests: absThresh with asymetrical lookBack and lookAhead +//mid tests: threshold with asymetrical lookBack and lookAhead FluidBufAmpGate.process(s, b, indices:c, rampUp:5, rampDown:25, onThreshold:-12, offThreshold: -12, lookBack:221, lookAhead:441) c.query c.getn(0,c.numFrames*2,{|item|item.postln;})