Hi,
The first is that I would like to include mapping of the overall duration of the slice in the Plotter
Do you mean you’d like the duration to have so
me impact on how the points are positioned? If so, you can include them in the ~analyses
as another column:
(
~analyses = FluidDataSet(s);
~durations = Dictionary();
~indices.loadToFloatArray(action:{
arg fa;
var mfccs = Buffer(s);
var stats = Buffer(s);
var flat = Buffer(s);
var flatPlusDur = Buffer.alloc(s,14); //alloc num features + 1 to also record duration
fa.doAdjacentPairs{
arg start, end, i;
var num = end - start;
FluidBufMFCC.processBlocking(s,~src,start,num,features:mfccs,numCoeffs:13,startCoeff:1);
FluidBufStats.processBlocking(s,mfccs,stats:stats,select:[\mean]);
FluidBufFlatten.processBlocking(s,stats,destination:flat);
FluidBufCompose.processBlocking(s,flat,destination: flatPlusDur); //copy the flattened MFFC stats to our final buffer
flatPlusDur.set(13,num); //set the last sample of flatPlusDur to the duration
~analyses.addPoint(i,flatPlusDur);
"analyzing slice % / %".format(i+1,fa.size-1).postln;
if((i%100) == 99){s.sync;}
};
s.sync;
~analyses.print;
});
)
On the other hand, if you mean you want to use the duration to, e.g., scale the points – let’s say that you record a language side Dictionary
with the durations and slice labels in (i.e. i
and num
in the analysis code block (e.g. ~durations.put(i, num)
. Then you could use this in the rendering
(
~normed.dump({
arg dict;
var point = Buffer.alloc(s,2);
var previous = nil;
defer{
var plt = FluidPlotter(dict:dict,mouseMoveAction:{
arg view, x, y;
[x,y].postln;
point.setn(0,[x,y]);
~tree.kNearest(point,1,{
arg nearest;
if(nearest != previous){
nearest.postln;
view.highlight_(nearest);
~play_slice.(nearest.asInteger);
previous = nearest;
}
});
});
// separate IDs and durations, scale the durs (probably a nicer way to do this)
var durations_delaced = ~durations.asPairs.clump(2).flop;
durations_delaced[1] = durations_delaced[1].normalize(min:0.25, max:5);
durations_delaced.flop.do{ |a|
plt.pointSize_(a[0], a[1]);
};
plt.refresh;
}
});
)
Which maybe gives an indication of talking to the plotter through code as well?