[breaking change] Sample signals from query onset, rather than midpoint (#1278)

This changes almost everything involving signals, including all use of random numbers.
This commit is contained in:
Alex McLean 2025-02-05 15:10:53 +00:00 committed by GitHub
parent 018d1ccd31
commit 49e9b84962
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6446 additions and 6462 deletions

View file

@ -16,7 +16,7 @@ export function steady(value) {
}
export const signal = (func) => {
const query = (state) => [new Hap(undefined, state.span, func(state.span.midpoint()))];
const query = (state) => [new Hap(undefined, state.span, func(state.span.begin))];
return new Pattern(query);
};
@ -158,7 +158,7 @@ const timeToRands = (t, n) => timeToRandsPrime(timeToIntSeed(t), n);
* n(run(4)).scale("C4:pentatonic")
* // n("0 1 2 3").scale("C4:pentatonic")
*/
export const run = (n) => saw.range(0, n).floor().segment(n);
export const run = (n) => saw.range(0, n).round().segment(n);
/**
* Creates a pattern from a binary number.