Skip to content

Commit 22bf887

Browse files
committed
2 parents 769574e + dbf653f commit 22bf887

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

packages/core/src/graph.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function parseInput(input, node) {
1919
"tried to parse function input without without passing node.."
2020
);
2121
}
22-
return node.apply(input);
22+
return input(node);
2323
}
2424
if (typeof input === "object") {
2525
// is node
@@ -63,12 +63,13 @@ function getNode(type, ...args) {
6363
}
6464
arg = new Node(polyType).withIns(...arg);
6565
}
66-
/* if (typeof arg === "function") {
67-
const peek = arg(new Node("foo"));
66+
if (typeof arg === "function") {
67+
// if we have a feedback function, we need to check if it expands
68+
const peek = arg(new Node("peek")); // the input node type doesn't matter
6869
if (peek.type === polyType) {
6970
maxExpansions = Math.max(peek.ins.length, maxExpansions);
7071
}
71-
} */
72+
}
7273
if (arg.type === polyType) {
7374
maxExpansions = Math.max(arg.ins.length, maxExpansions);
7475
}
@@ -104,7 +105,12 @@ function getNode(type, ...args) {
104105
const input = parseInput(arg.ins[i % arg.ins.length], cloned);
105106
return input.inherit(arg);
106107
}
107-
return parseInput(arg, cloned); // wire up cloned node for feedback..
108+
arg = parseInput(arg, cloned); // wire up cloned node for feedback..
109+
if (arg.type === polyType) {
110+
// this can happen when arg was a function that contained multichannel expansion...
111+
arg = arg.ins[i];
112+
}
113+
return arg;
108114
});
109115
return cloned.withIns(...inputs);
110116
});

website/src/examples.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,13 @@ let impseq = module("impseq", (trig, ...step) =>
8282
);
8383
let feed = register("feed", (x, f) =>
8484
x.apply((dry) => {
85-
let wets = [];
85+
let wet;
8686
return dry
8787
.add((x) => {
88-
let wet = f(x);
89-
wets.push(wet);
88+
wet = f(x);
9089
return wet;
9190
})
92-
.apply((x) => poly(...wets));
91+
.apply(x => wet)
9392
})
9493
);
9594

website/src/pages/learn.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import DocLayout from "../layouts/doc.astro";
1010

1111
# What is kabelsalat?
1212

13-
**kabelsalat** (= cable salad) is a **live codable modular synthesizer** for the browser. It let's you write synthesizer patches with an easy to use language based on JavaScript.
13+
**kabelsalat** (= cable salad) is a **live codable modular synthesizer** for the browser. It lets you write synthesizer patches with an easy to use language based on JavaScript.
1414

1515
**You don't need coding skills to learn this!**
1616

0 commit comments

Comments
 (0)