Working version

This commit is contained in:
Aria 2025-11-16 19:38:59 -06:00
parent cc10122b71
commit 7a3bea6f90
2 changed files with 13 additions and 2 deletions

View file

@ -3653,10 +3653,11 @@ export const parray = (pats) => {
* .partials(binaryL(256))
*/
export const { partials } = register('partials', (list, pat) => {
debugger;
if (Array.isArray(list)) {
list = parray(list);
}
return pat.withValue((v) => ({...v, partials: list}));
return pat.withValue((v) => (l) => ({...v, partials: l})).appLeft(list);
});
/**
@ -3673,5 +3674,5 @@ export const { phases } = register('phases', (list, pat) => {
if (Array.isArray(list)) {
list = parray(list);
}
return pat.withValue((v) => ({...v, phases: list}));
return pat.withValue((v) => (l) => ({...v, phases: l})).appLeft(list);
});

View file

@ -96,6 +96,16 @@ note("c2 <eb2 <g2 g1>>".fast(2))
._scope()`}
/>
and with lists _of_ patterns:
<MiniRepl
client:idle
tune={`note("c2 <eb2 <g2 g1>>".fast(4))
.sound("user")
.partials([1, 0, "0 1", "0 1 0.3", rand])
._scope()`}
/>
Note that the first value in the `partials` array controls the magnitude of the fundamental harmonic rather than the DC offset, which is fixed at 0.
#### Phases