Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
felixroos committed Sep 4, 2024
2 parents 769574e + dbf653f commit 22bf887
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
16 changes: 11 additions & 5 deletions packages/core/src/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function parseInput(input, node) {
"tried to parse function input without without passing node.."
);
}
return node.apply(input);
return input(node);
}
if (typeof input === "object") {
// is node
Expand Down Expand Up @@ -63,12 +63,13 @@ function getNode(type, ...args) {
}
arg = new Node(polyType).withIns(...arg);
}
/* if (typeof arg === "function") {
const peek = arg(new Node("foo"));
if (typeof arg === "function") {
// if we have a feedback function, we need to check if it expands
const peek = arg(new Node("peek")); // the input node type doesn't matter
if (peek.type === polyType) {
maxExpansions = Math.max(peek.ins.length, maxExpansions);
}
} */
}
if (arg.type === polyType) {
maxExpansions = Math.max(arg.ins.length, maxExpansions);
}
Expand Down Expand Up @@ -104,7 +105,12 @@ function getNode(type, ...args) {
const input = parseInput(arg.ins[i % arg.ins.length], cloned);
return input.inherit(arg);
}
return parseInput(arg, cloned); // wire up cloned node for feedback..
arg = parseInput(arg, cloned); // wire up cloned node for feedback..
if (arg.type === polyType) {
// this can happen when arg was a function that contained multichannel expansion...
arg = arg.ins[i];
}
return arg;
});
return cloned.withIns(...inputs);
});
Expand Down
7 changes: 3 additions & 4 deletions website/src/examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,13 @@ let impseq = module("impseq", (trig, ...step) =>
);
let feed = register("feed", (x, f) =>
x.apply((dry) => {
let wets = [];
let wet;
return dry
.add((x) => {
let wet = f(x);
wets.push(wet);
wet = f(x);
return wet;
})
.apply((x) => poly(...wets));
.apply(x => wet)
})
);
Expand Down
2 changes: 1 addition & 1 deletion website/src/pages/learn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import DocLayout from "../layouts/doc.astro";

# What is kabelsalat?

**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.
**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.

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

Expand Down

0 comments on commit 22bf887

Please sign in to comment.