Merge branch 'pre-production' into production
commit
25b1383749
@ -1,101 +0,0 @@
|
|||||||
|
|
||||||
TestFluidCorpusManipulationServer : UnitTest
|
|
||||||
{
|
|
||||||
var waitForCounts, countsListener;
|
|
||||||
|
|
||||||
setUp{
|
|
||||||
waitForCounts = Condition.new(false);
|
|
||||||
countsListener = { |s,changed|
|
|
||||||
if(changed == \counts) {
|
|
||||||
waitForCounts.test = true;
|
|
||||||
waitForCounts.signal;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Server.default.addDependant(countsListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
tearDown{
|
|
||||||
Server.default.removeDependant(countsListener);
|
|
||||||
Server.default.quit;
|
|
||||||
}
|
|
||||||
|
|
||||||
test_DataSetPersistence{
|
|
||||||
var foo, bar, tree, testPoint;
|
|
||||||
//No server on? You get nothing
|
|
||||||
this.assertEquals(nil,FluidDataSet(Server.default,\foo));
|
|
||||||
|
|
||||||
this.bootServer(Server.default);
|
|
||||||
// while {Server.default.serverRunning.not}{0.2.wait};
|
|
||||||
|
|
||||||
waitForCounts.test = false;
|
|
||||||
Server.default.doWhenBooted{foo=FluidDataSet(Server.default,\foo)};
|
|
||||||
waitForCounts.wait;
|
|
||||||
this.assertEquals(Server.default.numSynths,1,"Dataset: One Synth present after deferred boot");
|
|
||||||
waitForCounts.test = false;
|
|
||||||
foo.free;
|
|
||||||
waitForCounts.wait;
|
|
||||||
this.assertEquals(Server.default.numSynths,0,"Dataset: No synth present via cretation after free");
|
|
||||||
foo=FluidDataSet(Server.default,\foo);
|
|
||||||
//Uniqueness test (difficult to run with previous instance of foo, because
|
|
||||||
//UnitTest.bootServer messes with Server alloctors and screws up the ID cache
|
|
||||||
this.assertException({
|
|
||||||
bar = FluidDataSet(Server.default,\foo);
|
|
||||||
},FluidDataSetExistsError,"DataSetDuplicateError on reused name", onFailure:{
|
|
||||||
"Exception fail".postln;
|
|
||||||
});
|
|
||||||
|
|
||||||
waitForCounts.test = false;
|
|
||||||
bar = FluidDataSet(Server.default,\bar);
|
|
||||||
waitForCounts.wait;
|
|
||||||
this.assertEquals(Server.default.numSynths,2,"Dataset: Two Synths present after new valid Dataset added");
|
|
||||||
|
|
||||||
testPoint = Buffer.alloc(Server.default,8);
|
|
||||||
Server.default.sync;
|
|
||||||
testPoint.setn(0,[1,2,3,4,5,6,7,8]);
|
|
||||||
Server.default.sync;
|
|
||||||
foo.addPoint(\one,testPoint);
|
|
||||||
Server.default.sync;
|
|
||||||
foo.size({|size|
|
|
||||||
this.assertEquals(size,1,"Dataset size is 1");
|
|
||||||
});
|
|
||||||
Server.default.sync;
|
|
||||||
foo.cols({|cols|
|
|
||||||
this.assertEquals(cols,8,"Dataset cols is 8");
|
|
||||||
});
|
|
||||||
|
|
||||||
Server.default.sync;
|
|
||||||
waitForCounts.test = false;
|
|
||||||
|
|
||||||
tree = FluidKDTree(Server.default);
|
|
||||||
waitForCounts.wait;
|
|
||||||
|
|
||||||
this.assert(tree.synth.notNil,"Tree should have a valid synth");
|
|
||||||
this.assertEquals(Server.default.numSynths,3,"Dataset: Three Synths remain after cmd-.");
|
|
||||||
|
|
||||||
tree.fit(foo);
|
|
||||||
Server.default.sync;
|
|
||||||
tree.cols({|cols|
|
|
||||||
this.assertEquals(cols,8,"KDTree correct dims after fit")
|
|
||||||
});
|
|
||||||
Server.default.sync;
|
|
||||||
|
|
||||||
//Test cmd-period resistance
|
|
||||||
waitForCounts.test = false;
|
|
||||||
Server.default.freeAll;
|
|
||||||
Server.default.sync;
|
|
||||||
Server.default.sync;
|
|
||||||
waitForCounts.wait;
|
|
||||||
|
|
||||||
this.assertEquals(Server.default.numSynths,3,"Dataset: Three Synths remain after cmd-.");
|
|
||||||
foo.size({|size|
|
|
||||||
this.assertEquals(size,1,"Dataset size is still 1 after Cmd-.");
|
|
||||||
});
|
|
||||||
Server.default.sync;
|
|
||||||
foo.cols({|cols|
|
|
||||||
this.assertEquals(cols,8,"Dataset cols is still 8 after Cmd-.");
|
|
||||||
});
|
|
||||||
Server.default.sync;
|
|
||||||
tree.cols({|cols| this.assertEquals(cols,8,"KDTree correct dims after Cmd-.")});
|
|
||||||
Server.default.sync;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,72 +0,0 @@
|
|||||||
(
|
|
||||||
s.waitForBoot{
|
|
||||||
//var audio = Buffer.readChannel(s,FluidFilesPath("Tremblay-CEL-GlitchyMusicBoxMelo.wav"),channels:[0]);
|
|
||||||
// var audio = Buffer.readChannel(s,FluidFilesPath("Nicol-LoopE-M.wav"),channels:[0]);
|
|
||||||
var audio = Buffer.readChannel(s,FluidFilesPath("Harker-DS-TenOboeMultiphonics-M.wav"),channels:[0]);
|
|
||||||
|
|
||||||
var window = Window(bounds:Rect(0,0,1600,400));
|
|
||||||
var mels = Buffer(s);
|
|
||||||
var mags = Buffer(s);
|
|
||||||
var chroma = Buffer(s);
|
|
||||||
var mfccs = Buffer(s);
|
|
||||||
var addLayer = {
|
|
||||||
arg win, imageBuffer, color, imageAlpha, colorScaling;
|
|
||||||
imageBuffer.loadToFloatArray(action:{
|
|
||||||
arg vals;
|
|
||||||
fork({
|
|
||||||
var colors = CSVFileReader.readInterpret(FluidFilesPath("../color-schemes/%.csv".format(color))).collect{
|
|
||||||
arg row;
|
|
||||||
Color.fromArray(row);
|
|
||||||
};
|
|
||||||
var img = Image(imageBuffer.numFrames,imageBuffer.numChannels);
|
|
||||||
|
|
||||||
colorScaling.switch(
|
|
||||||
0,{
|
|
||||||
var minItem = vals.minItem;
|
|
||||||
vals = (vals - minItem) / (vals.maxItem - minItem);
|
|
||||||
vals = (vals * 255).asInteger;
|
|
||||||
},
|
|
||||||
1,{
|
|
||||||
vals = (vals + 1e-6).log;
|
|
||||||
vals = vals.linlin(vals.minItem,vals.maxItem,0.0,255.0).asInteger;
|
|
||||||
// vals.postln;
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"% colorScaling argument % is invalid.".format(thisMethod,colorScaling).warn;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
vals.do{
|
|
||||||
arg val, index;
|
|
||||||
/* img.postln;
|
|
||||||
index.postln;
|
|
||||||
val.postln;*/
|
|
||||||
img.setColor(colors[val], index.div(imageBuffer.numChannels), imageBuffer.numChannels - 1 - index.mod(imageBuffer.numChannels));
|
|
||||||
};
|
|
||||||
|
|
||||||
UserView(win,Rect(0,0,win.bounds.width,win.bounds.height))
|
|
||||||
.drawFunc_{
|
|
||||||
img.drawInRect(Rect(0,0,win.bounds.width,win.bounds.height),fraction:imageAlpha);
|
|
||||||
};
|
|
||||||
},AppClock)
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
FluidBufMelBands.processBlocking(s,audio,features:mels);
|
|
||||||
FluidBufSTFT.processBlocking(s,audio,magnitude:mags);
|
|
||||||
FluidBufChroma.processBlocking(s,audio,features:chroma);
|
|
||||||
FluidBufMFCC.processBlocking(s,audio,features:mfccs);
|
|
||||||
|
|
||||||
s.sync;
|
|
||||||
|
|
||||||
"analysis done".postln;
|
|
||||||
|
|
||||||
// addLayer.(window,imageBuffer:mags,color:"CET-L02",imageAlpha:0.7,colorScaling:1);
|
|
||||||
addLayer.(window,imageBuffer:mels,color:"CET-L02",imageAlpha:1,colorScaling:1);
|
|
||||||
|
|
||||||
// addLayer.(window,imageBuffer:chroma,color:"CET-L16",imageAlpha:0.5,colorScaling:1);
|
|
||||||
addLayer.(window,imageBuffer:mfccs,color:"CET-L16",imageAlpha:0.3,colorScaling:0);
|
|
||||||
|
|
||||||
window.front;
|
|
||||||
};
|
|
||||||
)
|
|
||||||
Loading…
Reference in New Issue