Skip to content

Commit

Permalink
blops code
Browse files Browse the repository at this point in the history
  • Loading branch information
dxinteractive committed Aug 10, 2024
1 parent f06b80a commit 5252e2f
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion dev/src/dsp-definitions/44-c4-blops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,30 @@ import type { DspDefinition } from "../types";

const dsp = `
import("stdfaust.lib");
// consts
peak = 0.65;
threshold = peak * 0.02;
// utils
zero_crosses(x) = (x' > 0) != (x > 0);
crossed_up(x) = (x' < 0) & (x >= 0);
// process
input = _;
is_note_on = _ : an.amp_follower_ar(0.00001, 0.01) > threshold;
devfn(x) = crosses,cycle
with {
note_on = is_note_on(x);
crosses = x : *(note_on) : crossed_up;
crosses_on = crosses + (1 - note_on);
cycle = ba.countup(10000, crosses_on') : ba.sAndH(crosses_on);
};
dev_crosses_on = _ : devfn : _,!;
dev_cycle = _ : devfn : !,_;
process = _ <: _,_;
`;

Expand All @@ -15,8 +38,9 @@ const dspDefinition: DspDefinition = {
type: "offline",
channels: 1,
sampleRate: 48000,
output: ["input", "process"],
output: ["input", "dev_crosses_on", "dev_cycle"],
outputLength: 48000 * 2.46,
inputOffset: 1000,
};

export default dspDefinition;

0 comments on commit 5252e2f

Please sign in to comment.