mirror of
https://codeberg.org/uzu/strudel
synced 2026-08-15 09:38:28 -04:00
Apply the same fix to square and randrun
This commit is contained in:
@@ -114,7 +114,7 @@ export const cosine2 = sine2._early(Fraction(1).div(4));
|
||||
* n(square.segment(4).range(0,7)).scale("C:minor")
|
||||
*
|
||||
*/
|
||||
export const square = signal((t) => Math.floor((t * 2) % 2));
|
||||
export const square = signal((t) => Math.floor(_mod((t * 2), 2)));
|
||||
|
||||
/**
|
||||
* A square signal between -1 and 1 (like `square`, but bipolar).
|
||||
@@ -397,7 +397,7 @@ export const randrun = (n) => {
|
||||
.map((n, i) => [n, i])
|
||||
.sort((a, b) => (a[0] > b[0]) - (a[0] < b[0]))
|
||||
.map((x) => x[1]);
|
||||
const i = t.cyclePos().mul(n).floor() % n;
|
||||
const i = _mod(t.cyclePos().mul(n).floor(), n);
|
||||
return nums[i];
|
||||
})._segment(n);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user