Greetings,
I seem to remember something about this recently, maybe @spluta knows, but I can’t find a thread on here that addresses. Basically my FluidProcessSlices crashes before completing all the slices. It will get through a different number of slices each time, so I can’t figure out what might be causing it.
I’m on SC 3.11.0 now.
Here’s an example.
(
s.waitForBoot({
Task({
var target_path = "/Users/ted/Desktop/SCD/flucoma/quick brown fox.wav";
var corpus_path = "/Users/ted/Desktop/SCD/flucoma/200613 eurorack 01 last 10 min excerpt_MONO.wav";
var dir = "/Users/ted/Desktop/SCD/flucoma/";
var timestamp = Date.localtime.stamp;
var target_loader = FluidLoadFolder();
var corpus_loader = FluidLoadFolder();
var target_slicer, corpus_slicer;
var print_index_info = {
arg index, buffer, name;
"index: %".format(name).postln;
"n slices: %".format(index.size).postln;
"avg dur: %".format(buffer.duration/index.size).postln;
"".postln;
};
// load target and corpus ======================================
target_loader.setFilesArray([SoundFile.openRead(target_path)]);
corpus_loader.setFilesArray([SoundFile.openRead(corpus_path)]);
target_loader.play(s,{"target loaded".postln;});
corpus_loader.play(s,{"corpus loaded".postln;});
s.sync;
// slice target and corpus ====================================
target_slicer = FluidSliceCorpus({ |src,start,num,dest|
FluidBufNoveltySlice.kr(src,start,num,indices:dest, threshold:0.57);
});
corpus_slicer = FluidSliceCorpus({
arg src, start, num, dest;
FluidBufNoveltySlice.kr(src,start,num,indices:dest,threshold:0.6);
});
target_slicer.play(s,target_loader.buffer,target_loader.index,{
arg target_sliced_index;
corpus_slicer.play(s,corpus_loader.buffer,corpus_loader.index,{
arg corpus_sliced_index;
var process_slices;
//target_sliced_index.postln;
//corpus_sliced_index.postln;
//print_index_info.(target_sliced_index,target_loader.buffer,"target");
//print_index_info.(corpus_sliced_index,corpus_loader.buffer,"corpus");
process_slices = {
arg buffer, index, dataset, action;
Task({
var extractor;
var mfccBuf = 4.collect{Buffer.new};
var pitchBuf = 4.collect{Buffer.new};
var specBuf = 4.collect{Buffer.new};
var loudBuf = 4.collect{Buffer.new};
var mfcc_stats = 4.collect{Buffer.new};
var pitch_stats = 4.collect{Buffer.new};
var spec_stats = 4.collect{Buffer.new};
var loud_stats = 4.collect{Buffer.new};
var comp_buf = 4.collect{Buffer.new};
var master_buf = 4.collect{Buffer.new};
s.sync;
extractor = FluidProcessSlices({|src,start,num,data|
var label = data.key;
var voice = data.value[\voice];
var t1 = FluidBufMFCC.kr(src,start,num,features:mfccBuf[voice],trig:1); // 13 channels
var t2 = FluidBufPitch.kr(src,start,num,features:pitchBuf[voice],trig:Done.kr(t1)); // 2 channels
var t3 = FluidBufSpectralShape.kr(src,start,num,features:specBuf[voice],trig:Done.kr(t2)); // 7 channels
var t4 = FluidBufLoudness.kr(src,start,num,features:loudBuf[voice],trig:Done.kr(t3)); // 2 channels
var t5 = FluidBufStats.kr(mfccBuf[voice],startChan:1,stats:mfcc_stats[voice],trig:Done.kr(t4)); // 12 channels. 7 frames
var t6 = FluidBufStats.kr(pitchBuf[voice],stats:pitch_stats[voice],trig:Done.kr(t5)); // 2 channels, 7 frames
var t7 = FluidBufStats.kr(specBuf[voice],stats:spec_stats[voice],trig:Done.kr(t6)); // 7 channels 7 frames
var t8 = FluidBufStats.kr(loudBuf[voice],numChans:1,stats:loud_stats[voice],trig:Done.kr(t7)); // 1 channel, 7 frames
var t9 = FluidBufCompose.kr(mfcc_stats[voice] ,0,1,0,-1,1,comp_buf[voice],0,0 ,0,Done.kr(t8));
var t10 = FluidBufCompose.kr(pitch_stats[voice],0,1,0,-1,1,comp_buf[voice],0,12,0,Done.kr(t9));
var t11 = FluidBufCompose.kr(spec_stats[voice] ,0,1,0,-1,1,comp_buf[voice],0,14,0,Done.kr(t10));
var t12 = FluidBufCompose.kr(loud_stats[voice] ,0,1,0,-1,1,comp_buf[voice],0,21,0,Done.kr(t11)); // total 22 channels
var t13 = FluidBufFlatten.kr(comp_buf[voice],master_buf[voice],trig:Done.kr(t12));
FluidDataSetWr.kr(dataset,label, -1, master_buf[voice], Done.kr(t13));
});
s.sync;
extractor.play(s,buffer,index,action:{
action.value(buffer,index,dataset);
});
}).play;
};
Task({
var target_ds = FluidDataSet(s,\target);
var corpus_ds = FluidDataSet(s,\corpus);
s.sync;
process_slices.(target_loader.buffer,/*target_sliced_index*/target_loader.index,target_ds,{
process_slices.(corpus_loader.buffer,/*corpus_sliced_index*/target_loader.index,corpus_ds,{
target_ds.write("%%_target_ds.json".format(dir,timestamp));
corpus_ds.write("%%_corpus_ds.json".format(dir,timestamp));
JSONFileWriter(target_sliced_index,"%%_target_sliced_index.json".format(dir,timestamp));
JSONFileWriter(corpus_sliced_index,"%%_corpus_sliced_index.json".format(dir,timestamp));
});
});
}).play;
});
});
}).play;
});
)