feat(sound): body-play mapping functions
This commit is contained in:
@@ -35,5 +35,40 @@
|
||||
m[\root] + (oct * 12) + scale[deg];
|
||||
};
|
||||
|
||||
// -- 3. Mapping pose -> musique -- fonctions pures ----------------------
|
||||
~bpMap = ();
|
||||
|
||||
~bpMap[\tempo] = { |modeKey, speed|
|
||||
var m = ~bpModes[modeKey];
|
||||
(speed ? 0).linlin(0.0, 0.6, m[\tempoLo], m[\tempoHi]).clip(m[\tempoLo], m[\tempoHi]);
|
||||
};
|
||||
|
||||
~bpMap[\leadNote] = { |modeKey, hf|
|
||||
~bpScale.(modeKey, (hf[\ry] ? 0), 2);
|
||||
};
|
||||
|
||||
~bpMap[\leadTrig] = { |hf, lastTrigTime, now|
|
||||
((hf[\rspeed] ? 0) > 0.12) and: { (now - lastTrigTime) > 0.09 };
|
||||
};
|
||||
|
||||
// 4 triades diatoniques I/IV/V/vi construites sur l'echelle du mode.
|
||||
~bpMap[\chordDegrees] = { |modeKey, hf|
|
||||
var m = ~bpModes[modeKey];
|
||||
var sc = m[\scale];
|
||||
var roots = [0, 3, 4, 5]; // index de degre des 4 accords
|
||||
var ci = ((hf[\ly] ? 0).clip(0,1) * 3).round.asInteger; // main G hauteur -> accord
|
||||
var base = roots[ci];
|
||||
var octShift = ((hf[\lopen] ? 0) > 0.5).if({ 12 }, { 0 });
|
||||
[0, 2, 4].collect { |step|
|
||||
var d = base + step;
|
||||
m[\root] + ((d div: sc.size) * 12) + sc[d % sc.size] + octShift;
|
||||
};
|
||||
};
|
||||
|
||||
~bpMap[\density] = { |modeKey, speed|
|
||||
var m = ~bpModes[modeKey];
|
||||
(((speed ? 0).linlin(0.0, 0.6, 1, 4) * m[\hatMul]).round.asInteger).clip(1, 4);
|
||||
};
|
||||
|
||||
"[data-only/scene_pose_play] modes + scale ready".postln;
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user