feat(sound): body-play mapping functions

This commit is contained in:
L'électron rare
2026-06-27 12:42:15 +02:00
parent c2c9753c8c
commit 83ea2be4e6
+35
View File
@@ -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;
)