diff --git a/packages/superdough/reverbGen.mjs b/packages/superdough/reverbGen.mjs index d2533cae4..bb050874c 100644 --- a/packages/superdough/reverbGen.mjs +++ b/packages/superdough/reverbGen.mjs @@ -104,6 +104,8 @@ var applyGradualLowpass = function (input, lpFreqStart, lpFreqEnd, lpFreqEndAt, player.start(); context.oncomplete = function (event) { callback(event.renderedBuffer); + filter.disconnect(); + player.disconnect(); }; context.startRendering(); diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 4827ffbd3..65c444120 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -708,7 +708,8 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) roomIR = await loadBuffer(url, ac, ir, 0); } orbitBus.getReverb(roomsize, roomfade, roomlp, roomdim, roomIR, irspeed, irbegin); - orbitBus.sendReverb(post, room); + const send = orbitBus.sendReverb(post, room); + audioNodes.push(send); } if (djf != null) { diff --git a/packages/superdough/superdoughoutput.mjs b/packages/superdough/superdoughoutput.mjs index afe91e71e..a4235efd0 100644 --- a/packages/superdough/superdoughoutput.mjs +++ b/packages/superdough/superdoughoutput.mjs @@ -78,7 +78,7 @@ export class Orbit { return this.reverbNode; } sendReverb(node, amount) { - effectSend(node, this.reverbNode, amount); + return effectSend(node, this.reverbNode, amount); } sendDelay(node, amount) { diff --git a/packages/supradough/dough.mjs b/packages/supradough/dough.mjs index 1cb9241ad..7231792c9 100644 --- a/packages/supradough/dough.mjs +++ b/packages/supradough/dough.mjs @@ -1,11 +1,12 @@ // this is dough, the superdough without dependencies -// @ts-check +// @ts-nocheck // @ts-ignore ignore next line because sampleRate is unknown const SAMPLE_RATE = typeof sampleRate !== 'undefined' ? sampleRate : 48000; const PI_DIV_SR = Math.PI / SAMPLE_RATE; const ISR = 1 / SAMPLE_RATE; let gainCurveFunc = (val) => Math.pow(val, 2); +const clamp = (num, min, max) => Math.min(Math.max(num, min), max); function applyGainCurve(val) { return gainCurveFunc(val); @@ -151,7 +152,8 @@ export class TwoPoleFilter { resonance = Math.max(resonance, 0); cutoff = Math.min(cutoff, 20000); - const c = 2 * Math.sin(cutoff * PI_DIV_SR); + let c = 2 * Math.sin(cutoff * PI_DIV_SR); + c = clamp(c, 0, 1.14); // this line prevents instability TODO: test const r = Math.pow(0.5, (resonance + 0.125) / 0.125); const mrc = 1 - r * c; diff --git a/packages/web/README.md b/packages/web/README.md index 659c82713..e86600cd7 100644 --- a/packages/web/README.md +++ b/packages/web/README.md @@ -62,7 +62,7 @@ initStrudel(); document.getElementById('play').addEventListener('click', () => evaluate('note("c a f e").jux(rev)') ); -document.getElementById('play').addEventListener('stop', +document.getElementById('stop').addEventListener('click', () => hush() ); ``` diff --git a/website/src/pages/technical-manual/project-start.mdx b/website/src/pages/technical-manual/project-start.mdx index 4a269d1b9..810897d2d 100644 --- a/website/src/pages/technical-manual/project-start.mdx +++ b/website/src/pages/technical-manual/project-start.mdx @@ -32,7 +32,7 @@ There are 3 quick ways to embed strudel in your website: ### Inside an iframe -Using an iframe is the most easy way to embed a studel tune. +Using an iframe is the most easy way to embed a strudel tune. You can embed any pattern of your choice via an iframe and the URL of the pattern of your choice: ```html @@ -133,7 +133,7 @@ If you'd rather use your own UI, you can use the `@strudel/web` package: ``` -For more info on this package, see the [@strudel/web README]https://codeberg.org/uzu/strudel/src/branch/main/packages/web#strudel-web). +For more info on this package, see the [@strudel/web README](https://codeberg.org/uzu/strudel/src/branch/main/packages/web#strudel-web). ## Via npm