@d-healey
It’s achieved; I’m loading samples based on their tokens and creating a module structure. Right now I’m only loading one mic (OH_M) and there are 6 other mic positions to load later with multimic. I should probably investigate doing it manually and exporting the sample map to see how it is represented there, if it is.
const
var dataObj = Engine.loadFromJSON("../ArticulationData.json");
include("UI.js");
function createModule(type, name, parent) {
if (type.toLowerCase() == "sampler") {
var type = builder.SoundGenerators.StreamingSampler;
} else {
var type = builder.SoundGenerators.SynthChain;
}
var module = builder.create(type, name, parent, builder.ChainIndexes.Direct);
return module;
}
function createSampleObj(fName, note1, note2, loVel, hiVel, RRGroup /*(j+1)*/ , Duplicate /*0*/ ) {
var obj = {
FileName: fName,
Root: note1,
LoKey: note1,
HiKey: note1,
LoVel: loVel,
HiVel: hiVel,
RRGroup: RRGroup,
Duplicate: Duplicate
};
return obj
}
var builder = Synth.createBuilder();
builder.clear();
var sampleMap = [];
var stopper = 0;
for (group in dataObj) {
stopper++;
var groupSampler = createModule("Sampler", group, 0);
include("SetSamplerAttributes.js");
sampleMap = [];
for (hit in dataObj[group]) {
var rrGroups = dataObj[group][hit].RRGroups;
var rrSize = dataObj[group][hit].RRSize;
var Layers = dataObj[group][hit].Layers;
var note1 = dataObj[group][hit].Note1;
var note2 = dataObj[group][hit].Note2;
var count = 0;
for (i = 0; i < rrGroups; i++) { // for each rrGroup
for (j = 0; j < rrSize && count < Layers; j++) {
count++;
include("SampleSortConsolePrint.js");
var fName = "{PROJECT_FOLDER}" + group + "-" + hit + "-OH_M-" + count + ".wav";
include("VelocityMath.js");
var obj = createSampleObj(fName, note1, note2, loVel, hiVel, (j+1), 0);
sampleMap.push(obj);
if (count == Layers) { // only saves complete sample sets until overflow logic is complete
//Console.print("test");
Engine.dumpAsJSON(sampleMap, group + ".json");
}
}
Synth.getSampler(group).loadSampleMapFromJSON(sampleMap);
}
}
if (stopper > 4) break // Let's take it slow
}
builder.flush();
Working good!