From f580ce18f27d0c68f2c6222c65587932c7d6f4fe Mon Sep 17 00:00:00 2001 From: dxinteractive Date: Sat, 30 Dec 2023 01:41:39 +1100 Subject: [PATCH] sdkjdsf --- dev/src/dsp-definitions/34-additive-synth.ts | 36 ++++++++++++++++++++ dev/src/dsp-definitions/all.ts | 2 ++ 2 files changed, 38 insertions(+) create mode 100644 dev/src/dsp-definitions/34-additive-synth.ts diff --git a/dev/src/dsp-definitions/34-additive-synth.ts b/dev/src/dsp-definitions/34-additive-synth.ts new file mode 100644 index 0000000..db496ad --- /dev/null +++ b/dev/src/dsp-definitions/34-additive-synth.ts @@ -0,0 +1,36 @@ +import type { DspDefinition } from "../types"; + +const dsp = ` +import("stdfaust.lib"); + +// osc +a = button("a"); +b = button("b"); +c = button("c"); +gate = a | b | c; +pitch = ba.if(a, 60, ba.if(b, 62, 63)); + +// env +volA = hslider("attack",0.01,0.01,4,0.01); +volD = hslider("decay",2.6,0.01,8,0.01); +volS = hslider("sustain",1,0,1,0.01); +volR = hslider("release",2.0,0.01,8,0.01); + +envelop = en.adsre(volA,volD,volS,volR,gate); + +osc(f) = os.osc(f) + (os.osc(f * 2.0) * 0.2) + (os.osc(f * 6.0) * 0.1); + +fx = osc(pitch : ba.midikey2hz) * envelop * 0.3; + +process = fx <: _,_; +`; + +const dspDefinition: DspDefinition = { + id: "additive-synth", + name: "Additive synth", + description: "Additive synth", + dsp, + type: "live", +}; + +export default dspDefinition; diff --git a/dev/src/dsp-definitions/all.ts b/dev/src/dsp-definitions/all.ts index 280138f..59f62cd 100644 --- a/dev/src/dsp-definitions/all.ts +++ b/dev/src/dsp-definitions/all.ts @@ -33,6 +33,7 @@ import echoloop from "./30-echoloop"; import echoloopLive from "./31-echoloop-live"; import minSince from "./32-min-since"; import pitchtracker3 from "./33-pitchtracker-3"; +import additiveSynth from "./34-additive-synth"; export const all: DspDefinition[] = [ sineWave, @@ -68,4 +69,5 @@ export const all: DspDefinition[] = [ echoloopLive, minSince, pitchtracker3, + additiveSynth, ];