Compare commits

...

8 Commits

2 changed files with 21 additions and 1 deletions
+13 -1
View File
@@ -1449,7 +1449,19 @@ export function sequenceP(pats) {
export function stack(...pats) {
// Array test here is to avoid infinite recursions..
pats = pats.map((pat) => (Array.isArray(pat) ? sequence(...pat) : reify(pat)));
const query = (state) => flatten(pats.map((pat) => pat.query(state)));
const query = (state) =>
flatten(
pats.map((pat) => {
try {
// An error occurring in one part of the stack should not break
// playback of the other parts of the stack.
return pat.query(state);
} catch (e) {
errorLogger(e);
return [];
}
}),
);
const result = new Pattern(query);
if (__steps) {
result._steps = lcm(...pats.map((pat) => pat._steps));
+8
View File
@@ -346,3 +346,11 @@ s increase by one semitone, i.e. sharp, works for steps of scales, note names
$: at the start of a line, defines a member of the stack. is the only stack name that should occur multiple names
_ before a stack name: mutes the stack, i.e. hush(), for example _$: s("bd"), see above for a different usage.
```
## What is a 'hap'?
A 'hap' is a name for a thing that happens, e.g. `note("c3 -")` playing a note and then stopping after a while. Haps have a start and an end. Every separate sound that is produced by strudel is a hap on its own.
We would have called it 'event' if this particular name wasn't used by JavaScript to describe things that happen on html pages, like clicking on a button or hovering over a line of text.
Since strudel is written in JavaScript, this confusion of having the same name for different things is avoided by calling events 'haps'.