Well, it says “startpoint and endpoint”. I would think that would be the first and last sample. But this is saying that is the first sample and the sample after the last sample?
BTW - some observations:
loading enormous 5gb sets of files doesn’t seem to work. it seems the larger the data set audio buffer, the slower things go, by exponential proportions, and the more likely everything is to crash. this is most certainly a memory issue. Probably even loading all those buffers is a no no.
the more files i load, the more chance of a crash. if i load 10, 95MB files, it is sometimes able to process them all without crashing, sometimes not
for analyzing lots of big files, say fifty 95 mb files, with 718 points each, I settled on the code below. while not using all the slick stuff, due to the file size issue, it is still WAAAAYYYY better than before.
FluidEqualSlice class is at the bottom. I would love to know if there is a better way to do this with the tools. It is a bit clunky…but WAAAAYYY better than before.
There does seem to be a memory leak or something. The code will sometimes go for a while, sometimes not. I found that adding some waits in there made the crashing happen less often. But maybe the dataSet isn’t always being freed or something?
s.reboot
(
~mfccbuf = 4.collect{Buffer.new};
~statsbuf = 4.collect{Buffer.new};
~mean = 4.collect{Buffer.new};
~flatbuf = 4.collect{Buffer.new};
~path = “/Volumes/Samsung_T5/Adaggietto_441_24/Stretch_12_0.25_0.1/”;
~paths = PathName(~path++“Chans/Chan0/4/”).files;
)
(
~extractor2 = FluidProcessSlices({|src,start,num,data|
var mfcc, stats, writer, flatten,mfccBuf, statsBuf, flatBuf, label, voice;
label = data.key;
voice = data.value[\voice];
mfcc = FluidBufMFCC.kr(src,startFrame:start,numFrames:num,numChans:1,features:~mfccbuf[voice],trig:1);
stats = FluidBufStats.kr(~mfccbuf[voice],stats:~statsbuf[voice],trig:Done.kr(mfcc));
flatten = FluidBufFlatten.kr(~statsbuf[voice],~flatbuf[voice],trig:Done.kr(stats));
writer = FluidDataSetWr.kr(~ds,label, -1, ~flatbuf[voice], Done.kr(flatten))
});
~extractor = {|counter, action|
var extractor,path;
“extract”.postln;
path = ~paths[counter];
Buffer.read(s, path.fullPath, action:{|buf|
var slicer,index;
index = IdentityDictionary[(path.fileName.asSymbol -> IdentityDictionary[ ('bounds' -> [ 0, buf.numFrames ]), ('numchans' -> buf.numChannels), ('sr' -> buf.sampleRate) ])];
slicer = FluidEqualSlicer();
slicer.slice(buf, index);
~extractor2.play(s,buf.postln,slicer.index.postln,action:{"Features done".postln; action.value(buf)});
})
}
)
(
var counter, netAddr, func;
netAddr = NetAddr(“127.0.0.1”,NetAddr.langPort);
counter = 0;
//~ds.free;
~ds = FluidDataSet(s, \mfcc);
~extractor.value(0, ~ds,action:{|buffer|
buffer.free;
//counter.postln;
netAddr.sendMsg("/fluidCount")
});
func = OSCFunc({|msg|
Routine({
1.wait;
~ds.write(~path++“mfcc/Chan0/”++~paths[counter].fileNameWithoutExtension++".json");
“write json”.postln;
2.0.wait;
"counter ".post;
counter = counter+1;
counter.postln;
~ds.free;
3.0.wait;
~ds.free;
~ds = FluidDataSet(s, \mfcc);
if(counter.post<~paths.size.postln){
"do it again".postln;
~extractor.value(counter,~ds,action:{
netAddr.sendMsg("/fluidCount")})
}{
"free osc".postln;
func.free;
};
}).play;
}, ‘fluidCount’)
)
FluidEqualSlicer {
var <>index;
slice {|buffer, indexIn, chunkSize = 44100|
index = ();
[buffer, indexIn].postln;
indexIn.keys.do{|key|
var parent=indexIn[key], frames, bounds = [0,0], label;
[key, parent].postln;
frames = parent['bounds'][1]-parent['bounds'][0];
(frames/chunkSize).ceil.asInteger.do{|i|
var dict = IdentityDictionary(), lilDict, chunkPoint;
lilDict = parent.deepCopy;
chunkPoint = i*chunkSize+parent['bounds'][0];
lilDict.put('bounds', [chunkPoint, min(chunkPoint+chunkSize-1,parent['bounds'][1])]);
index.put((key++"-"++(i+1)).asSymbol, lilDict);
}
};
}
}