fix: clamp step degree and gate drum freq
This commit is contained in:
@@ -200,6 +200,7 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
|
||||
// colorAmp x stepVel x volOf; \dur = bar/16; inst/cutoff/pan/mod applied like the overlay.
|
||||
~matColorStepPattern = { |name, vi, color, spec, volOf, instPair, cdPairs|
|
||||
var freqRatio = 2 ** (spec[\octave] ? 0);
|
||||
var pitched = [\sub, \acid, \arp, \lead, \stab, \pad, \reese, \bells, \perc, \tom];
|
||||
var mod = ~matMod[vi];
|
||||
var modPairs = mod.isNil.if({ [] }, {
|
||||
var src = mod[\source], tgt = mod[\target], d = mod[\depth];
|
||||
@@ -211,6 +212,9 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
|
||||
{ [] }) // amp mod out of scope for v1
|
||||
})
|
||||
});
|
||||
var freqPair = pitched.includes(name).if({
|
||||
[\freq, Pfunc { |e| (~lpNote.notNil).if({ ~lpNote.(e[\degree], 0).midicps * freqRatio }, { 440 }) }]
|
||||
}, { [] });
|
||||
Pbind(*([
|
||||
\stepIdx, Pseq((0..15), inf),
|
||||
\matGlow, Pfunc { |e|
|
||||
@@ -220,13 +224,12 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
|
||||
},
|
||||
\type, Pfunc { |e| spec[\steps][e[\stepIdx]].isNil.if({ \rest }, { \note }) },
|
||||
\degree, Pfunc { |e| var s = spec[\steps][e[\stepIdx]]; s.isNil.if({ 0 }, { s[\degree] }) },
|
||||
\freq, Pfunc { |e| (~lpNote.notNil).if({ ~lpNote.(e[\degree], 0).midicps * freqRatio }, { 440 }) },
|
||||
\amp, Pfunc { |e|
|
||||
var s = spec[\steps][e[\stepIdx]];
|
||||
((spec[\amp] ? 1.0) * (s.isNil.if({ 0 }, { s[\vel] }))) * volOf.value },
|
||||
\stretch, spec[\stretch],
|
||||
\dur, ~matBeatsPerBar / 16
|
||||
] ++ instPair ++ cdPairs ++ modPairs))
|
||||
] ++ freqPair ++ instPair ++ cdPairs ++ modPairs))
|
||||
};
|
||||
|
||||
// -- ~matVariation : map color 1-6 to a Pchain overlay on the captured base --
|
||||
@@ -485,7 +488,7 @@ File.exists(~matDir).not.if({ ("mkdir -p " ++ ~matDir.quote).systemCmd });
|
||||
((degree == \rest) or: { degree.isNil }).if({
|
||||
steps[stepIdx] = nil
|
||||
}, {
|
||||
steps[stepIdx] = (degree: degree.asInteger, vel: vel.asFloat.clip(0, 1))
|
||||
steps[stepIdx] = (degree: degree.asInteger.clip(-48, 48), vel: vel.asFloat.clip(0, 1))
|
||||
});
|
||||
~matLastColor[vi] = -1;
|
||||
(~lp[\matPlaying] and: { ~matApplyBar.notNil }).if({ ~matApplyBar.(~lp[\matBar]) });
|
||||
|
||||
@@ -447,6 +447,18 @@ pass = pass and: { ~matPoseBindings[5].size == 1 };
|
||||
pass = pass and: { ~matPoseBindings[5][0][\poseId] == \poseA };
|
||||
File.delete(~matDir +/+ "pose_grid.matrix");
|
||||
|
||||
// --- Clamp: ~matSetStep must clip degree to -48..48 ---
|
||||
~matSetStep.(5, 2, 4, 200, 0.5);
|
||||
pass = pass and: { ~matColorDefs[5][2][\steps][4][\degree] == 48 };
|
||||
~matSetStep.(5, 2, 4, \rest, 0); // restore
|
||||
|
||||
// --- Drum \freq.isNil: stepped kick must NOT emit \freq ---
|
||||
~kickVi = ~matVoices.indexOf(\kick);
|
||||
~matSetStep.(~kickVi, 2, 0, 3, 0.8);
|
||||
~ev = ~matVariation.(\kick, 2, ~kickVi).asStream.next(());
|
||||
pass = pass and: { ~ev[\freq].isNil };
|
||||
~matColorDefs[~kickVi][2][\steps] = Array.fill(16, nil); // restore
|
||||
|
||||
pass.if(
|
||||
{ "TEST PASS".postln },
|
||||
{ "TEST FAIL".postln }
|
||||
|
||||
@@ -495,7 +495,7 @@ function renderSeq(vi) {
|
||||
if (e.shiftKey) {
|
||||
st2.vel = Math.max(0, Math.min(1, st2.vel + (e.deltaY < 0 ? 0.1 : -0.1)));
|
||||
} else {
|
||||
st2.degree += (e.deltaY < 0 ? 1 : -1);
|
||||
st2.degree = Math.max(-48, Math.min(48, st2.degree + (e.deltaY < 0 ? 1 : -1)));
|
||||
}
|
||||
send("/matrix/step", vi, c, s, st2.degree, st2.vel); saveMatState(); renderSeq(vi);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user