diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs index 625f40756..1df5c8776 100644 --- a/packages/core/test/pattern.test.mjs +++ b/packages/core/test/pattern.test.mjs @@ -796,7 +796,7 @@ describe('Pattern', () => { }); }); describe('apply', () => { - (it('Can apply a function', () => { + it('Can apply a function', () => { expect(sequence('a', 'b').apply(fast(2)).firstCycle()).toStrictEqual(sequence('a', 'b').fast(2).firstCycle()); }), it('Can apply a pattern of functions', () => { @@ -804,7 +804,7 @@ describe('Pattern', () => { expect(sequence('a', 'b').apply(fast(2), fast(3)).firstCycle()).toStrictEqual( sequence('a', 'b').fast(2, 3).firstCycle(), ); - })); + }); }); describe('layer', () => { it('Can layer up multiple functions', () => { diff --git a/packages/superdough/superdough.mjs b/packages/superdough/superdough.mjs index 8bf565581..738cbf48f 100644 --- a/packages/superdough/superdough.mjs +++ b/packages/superdough/superdough.mjs @@ -7,9 +7,18 @@ This program is free software: you can redistribute it and/or modify it under th import './feedbackdelay.mjs'; import './reverb.mjs'; import './vowel.mjs'; -import { _mod, cycleToSeconds } from './util.mjs'; +import { _mod, clamp, cycleToSeconds } from './util.mjs'; import workletsUrl from './worklets.mjs?audioworklet'; -import { createFilter, gainNode, getCompressor, getDistortion, getLfo, getWorklet, effectSend } from './helpers.mjs'; +import { + createFilter, + gainNode, + getCompressor, + getDistortion, + getLfo, + getWorklet, + effectSend, + webAudioTimeout, +} from './helpers.mjs'; import { map } from 'nanostores'; import { logger } from './logger.mjs'; import { loadBuffer } from './sampler.mjs'; @@ -296,22 +305,19 @@ function getPhaser(time, end, frequency = 1, depth = 0.5, centerFrequency = 1000 const ac = getAudioContext(); const lfoGain = getLfo(ac, time, end, { frequency, depth: sweep * 2 }); - // filters - const numStages = 8; // num of filters in series + //filters + const numStages = 2; //num of filters in series let fOffset = 0; const filterChain = []; - const fMin = centerFrequency * 0.5, - fMax = centerFrequency; - const ratio = Math.pow(fMax / fMin, 1 / numStages); for (let i = 0; i < numStages; i++) { const filter = ac.createBiquadFilter(); - filter.type = 'allpass'; + filter.type = 'notch'; filter.gain.value = 1; - filter.frequency.value = fMin * Math.pow(ratio, i + 0.5); - filter.Q.value = 2 - clamp(depth * 2, 0, 1.9); + filter.frequency.value = centerFrequency + fOffset; + filter.Q.value = 2 - Math.min(Math.max(depth * 2, 0), 1.9); lfoGain.connect(filter.detune); - fOffset += 4; + fOffset += 282; if (i > 0) { filterChain[i - 1].connect(filter); } @@ -617,8 +623,7 @@ export const superdough = async (value, t, hapDuration, cps = 0.5, cycle = 0.5) fx.coarse !== undefined && chain.push(getWorklet(ac, 'coarse-processor', { coarse: fx.coarse })); fx.crush !== undefined && chain.push(getWorklet(ac, 'crush-processor', { crush: fx.crush })); fx.shape !== undefined && chain.push(getWorklet(ac, 'shape-processor', { shape: fx.shape, postgain: shapevol })); - fx.distort !== undefined && - chain.push(getWorklet(ac, 'distort-processor', { distort: fx.distort, postgain: distortvol })); + fx.distort !== undefined && chain.push(getDistortion(fx.distort, distortvol, fx.distorttype)); let tremolo = fx.tremolo; if (fx.tremolosync != null) { diff --git a/packages/superdough/wavetable.mjs b/packages/superdough/wavetable.mjs index f259c342d..4357a0cf0 100644 --- a/packages/superdough/wavetable.mjs +++ b/packages/superdough/wavetable.mjs @@ -322,6 +322,6 @@ export async function onTriggerSynth(t, value, tables, cps, frameLen) { node.disconnect(); wtPosModulators?.disconnect(); wtWarpModulators?.disconnect(); - } + }; return handle; } diff --git a/website/src/components/Header/Search.css b/website/src/components/Header/Search.css index b14146cbd..456ef9f6b 100644 --- a/website/src/components/Header/Search.css +++ b/website/src/components/Header/Search.css @@ -18,8 +18,8 @@ --docsearch-modal-background: var(--background); --docsearch-muted-color: color-mix(in srgb, var(--foreground), #fff 30%); --docsearch-key-gradient: var(--foreground); - --docsearch-key-shadow: - inset 0 -2px 0 0 var(--gutterForeground), inset 0 0 1px 1px var(--foreground), 0 1px 2px 1px var(--gutterBackground); + --docsearch-key-shadow: inset 0 -2px 0 0 var(--gutterForeground), inset 0 0 1px 1px var(--foreground), + 0 1px 2px 1px var(--gutterBackground); } .dark { --docsearch-muted-color: color-mix(in srgb, var(--foreground), #000 30%);