Hi!
Firstly, thank you all fur such fantastic library and worderfull learning materials!!!
I am trying to run this example by @tedmoore which uses the external class PlotXYColor
. However, before the external class call, I am not able to get the proper results.
The original code file was missing and as I rewrite it on my own I think there can be some silly typing error.
I was supposed to provide a dataset with 45297 point, but during the execution it randomly stops at middle, posting the debug variable i
of something around 90 ~ 300. It does not crash, neither shows any error message.
I was afraid it could be some memory issue, but I got no warning and I also set:
s.options.memSize_(2**20);
s.options.numWireBufs = 128;
s.options.maxNodes = 2048 ;
s.options.numBuffers = 4096;
Any idea how to debug this?
(
s.waitForBoot{
var mfccbuf = Buffer(s);
var specbuf = Buffer(s);
var pitchbuf = Buffer(s);
var loudnessbuf = Buffer(s);
var flat = Buffer(s);
var point = Buffer(s);
var counter = 0;
var headers;
var frameToChannel = {
arg src, frame, startFrame;
FluidBufFlatten.processBlocking(s,src,frame,1,destination:flat);
FluidBufCompose.processBlocking(s,flat,destination:point,destStartFrame:startFrame);
};
var trainingData = FluidDataSet(s);
var trainingLabels = FluidLabelSet(s);
var buffers = [
Buffer.readChannel(s, FluidFilesPath("Tremblay-AaS-AcBassGuit-Melo-M.wav"), channels:[0]);
Buffer.readChannel(s, FluidFilesPath("Tremblay-CEL-GlitchyMusicBoxMelo.wav"), channels:[0]);
];
s.sync;
buffers = buffers.collect{ // remove all the silence parts from a buffer
arg src;
var indices = Buffer(s);
var temp = Buffer(s);
FluidBufAmpGate.processBlocking(s,src,indices:indices,onThreshold:-30,offThreshold:-35,minSliceLength:4410);
indices.loadToFloatArray(action:{
arg fa; // fa == floatArray
var curr = 0;
fa.clump(2).do{
arg arr;
var start = arr[0];
var num = arr[1] - start;
FluidBufCompose.processBlocking(s,src,start,num,destination: temp, destStartFrame: curr);
curr = curr + num;
};
indices.free;
src.free;
});
temp;
};
s.sync;
"done stripping silence".postln;
// analysis
buffers.do{ // make every single fft frame a analysis (no stats) and can allow realtime latter
arg buf, buffer_i;
FluidBufMFCC.processBlocking(s,buf,features: mfccbuf);
FluidBufSpectralShape.processBlocking(s,buf,features: specbuf);
FluidBufPitch.processBlocking(s,buf,features: pitchbuf);
FluidBufLoudness.processBlocking(s,buf,features: loudnessbuf);
s.sync;
"done FluidBuf".postln;
"numFrames: %".format(mfccbuf.numFrames).postln;
mfccbuf.numFrames.do{
arg i;
var id = "analysis-%".format(counter);
frameToChannel.(mfccbuf,i,0); // 12 values
frameToChannel.(specbuf,i,13); // 7 values
frameToChannel.(pitchbuf,i,20); // 2 values
frameToChannel.(loudnessbuf,i,22); // 2 values
trainingData.addPoint(id,point); // buffer called point with 23 features
trainingLabels.addLabel(id,["bass","music-box"][buffer_i]);
counter = counter + 1;
i.postln;
if(i % 100 == 99){s.sync};
};
};
"Done frameToChannel".postln;
// make headers
headers = List.new;
headers.addAll(13.collect{arg i; "mfcc-%".format(i.asString.padLeft(2,"0"))});
headers.addAll(FluidSpectralShape.features);
headers.addAll(FluidPitch.features);
headers.addAll(FluidLoudness.features);
s.sync;
trainingData.print;
trainingLabels.print;
PlotXYColor.fromFluidDataSet(trainingData,trainingLabels,headerArray:headers.asArray);
}
)
Thanks!