|
|
@ -38,7 +38,7 @@ frNearestInList = {arg frComp, frDict;
|
|
|
|
frDict.reject({arg item;
|
|
|
|
frDict.reject({arg item;
|
|
|
|
(item[\root][0] == frComp[1]) ||
|
|
|
|
(item[\root][0] == frComp[1]) ||
|
|
|
|
(item[\fr] == frComp[1])
|
|
|
|
(item[\fr] == frComp[1])
|
|
|
|
}).keys.asList.sort({arg a, b; a.asString < b.asString}).do({arg fr;
|
|
|
|
}).keys.asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)}).do({arg fr;
|
|
|
|
var diff = abs(frToFloat.value(fr) - frToFloat.value(frComp[0]));
|
|
|
|
var diff = abs(frToFloat.value(fr) - frToFloat.value(frComp[0]));
|
|
|
|
if(diff < diffNearest, {diffNearest = diff; frNearest = fr});
|
|
|
|
if(diff < diffNearest, {diffNearest = diff; frNearest = fr});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -82,10 +82,13 @@ hdChoose = {arg mode, exp = 1, weights = [1, 1, 1, 1, 1, 1, 1];
|
|
|
|
mode.wchoose(probs.normalizeSum)
|
|
|
|
mode.wchoose(probs.normalizeSum)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//faster sorting algorithm?
|
|
|
|
wchooseDict = {arg dict, exp = 1, limit = 0, isFR = true;
|
|
|
|
wchooseDict = {arg dict, exp = 1, limit = 0;
|
|
|
|
|
|
|
|
var keyList, probs;
|
|
|
|
var keyList, probs;
|
|
|
|
keyList = dict.keys.asList.sort({arg a, b; a.asString < b.asString});
|
|
|
|
keyList = if(isFR, {
|
|
|
|
|
|
|
|
dict.keys.asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)});
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
dict.keys.asList.sort({arg a, b; a.convertDigits(2) < b.convertDigits(2)});
|
|
|
|
|
|
|
|
});
|
|
|
|
probs = keyList.collect({arg key;
|
|
|
|
probs = keyList.collect({arg key;
|
|
|
|
var count = dict[key][\count];
|
|
|
|
var count = dict[key][\count];
|
|
|
|
if(count < limit, {0}, {count})
|
|
|
|
if(count < limit, {0}, {count})
|
|
|
@ -95,7 +98,7 @@ wchooseDict = {arg dict, exp = 1, limit = 0;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
collectRoots = {arg dict; dict.keys.collect({arg fr;
|
|
|
|
collectRoots = {arg dict; dict.keys.collect({arg fr;
|
|
|
|
dict[fr][\root][0]}).asList.sort({arg a, b; a.asString < b.asString})
|
|
|
|
dict[fr][\root][0]}).asList.sort({arg a, b; harmonicDistance.value(a) < harmonicDistance.value(b)});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -192,7 +195,7 @@ genTemporalData = {arg lastTupleState, modeState, cadenceOverride, noParts = 4;
|
|
|
|
cadence = if(collectRoots.value(modeState).size == 1, {cadenceOverride.not}, {false});
|
|
|
|
cadence = if(collectRoots.value(modeState).size == 1, {cadenceOverride.not}, {false});
|
|
|
|
curTupleState = lastTupleState.deepCopy;
|
|
|
|
curTupleState = lastTupleState.deepCopy;
|
|
|
|
timeToNextEvent = (64 + 50.rand + if(cadence, {50}, {0})).round(16);
|
|
|
|
timeToNextEvent = (64 + 50.rand + if(cadence, {50}, {0})).round(16);
|
|
|
|
tuple = wchooseDict.value(curTupleState);
|
|
|
|
tuple = wchooseDict.value(curTupleState, isFR: false);
|
|
|
|
if(cadence, {tuple = [1, 1, 1]});
|
|
|
|
if(cadence, {tuple = [1, 1, 1]});
|
|
|
|
curTupleState = curTupleState.keysValuesDo({arg key, val;
|
|
|
|
curTupleState = curTupleState.keysValuesDo({arg key, val;
|
|
|
|
curTupleState[key][\count] = val[\count] + 1});
|
|
|
|
curTupleState[key][\count] = val[\count] + 1});
|
|
|
|