From 8781fa2e3312ed3d4d0e4c329562b9c33dab6cce Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 6 Jan 2023 21:37:31 +0100 Subject: [PATCH] add filter synonyms --- packages/core/controls.mjs | 29 ++++++++++---------- packages/webaudio/webaudio.mjs | 22 +++++++++++---- website/src/pages/learn/strudel-vs-tidal.mdx | 2 +- 3 files changed, 32 insertions(+), 21 deletions(-) diff --git a/packages/core/controls.mjs b/packages/core/controls.mjs index 8682f0e1..b156f721 100644 --- a/packages/core/controls.mjs +++ b/packages/core/controls.mjs @@ -155,22 +155,26 @@ const generic_params = [ * * @name bandf * @param {number | Pattern} frequency center frequency + * @synonyms bpf * @example * s("bd sd,hh*3").bandf("<1000 2000 4000 8000>") * */ ['f', 'bandf', 'A pattern of numbers from 0 to 1. Sets the center frequency of the band-pass filter.'], + ['f', 'bpf', ''], // TODO: in tidal, it seems to be normalized /** * Sets the q-factor of the band-pass filter * * @name bandq * @param {number | Pattern} q q factor + * @synonyms bpq * @example * s("bd sd").bandf(500).bandq("<0 1 2 3>") * */ ['f', 'bandq', 'a pattern of anumbers from 0 to 1. Sets the q-factor of the band-pass filter.'], + ['f', 'bpq', ''], /** * a pattern of numbers from 0 to 1. Skips the beginning of each sample, e.g. `0.25` to cut off the first quarter from each sample. * @@ -282,53 +286,50 @@ const generic_params = [ * * @name cutoff * @param {number | Pattern} frequency audible between 0 and 20000 + * @synonyms lpf * @example * s("bd sd,hh*3").cutoff("<4000 2000 1000 500 200 100>") * */ - // TODO: add lpf synonym ['f', 'cutoff', 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the low-pass filter.'], + ['f', 'lpf'], /** * Applies the cutoff frequency of the high-pass filter. * * @name hcutoff * @param {number | Pattern} frequency audible between 0 and 20000 + * @synonyms hpf * @example * s("bd sd,hh*4").hcutoff("<4000 2000 1000 500 200 100>") * */ - // TODO: add hpf synonym - [ - 'f', - 'hcutoff', - 'a pattern of numbers from 0 to 1. Applies the cutoff frequency of the high-pass filter. Also has alias @hpf@', - ], + ['f', 'hcutoff', ''], + ['f', 'hpf', ''], /** * Applies the resonance of the high-pass filter. * * @name hresonance * @param {number | Pattern} q resonance factor between 0 and 50 + * @synonyms hpq * @example * s("bd sd,hh*4").hcutoff(2000).hresonance("<0 10 20 30>") * */ - [ - 'f', - 'hresonance', - 'a pattern of numbers from 0 to 1. Applies the resonance of the high-pass filter. Has alias @hpq@', - ], + ['f', 'hpq', ''], + ['f', 'hresonance', ''], // TODO: add hpq synonym /** * Applies the cutoff frequency of the low-pass filter. * * @name resonance * @param {number | Pattern} q resonance factor between 0 and 50 + * @synonyms lpq * @example * s("bd sd,hh*4").cutoff(2000).resonance("<0 10 20 30>") * */ - ['f', 'resonance', 'a pattern of numbers from 0 to 1. Specifies the resonance of the low-pass filter.'], - // TODO: add lpq synonym? + ['f', 'lpq'], + ['f', 'resonance', ''], /** * DJ filter, below 0.5 is low pass filter, above is high pass filter. * diff --git a/packages/webaudio/webaudio.mjs b/packages/webaudio/webaudio.mjs index 4cac9083..11eb170b 100644 --- a/packages/webaudio/webaudio.mjs +++ b/packages/webaudio/webaudio.mjs @@ -211,12 +211,22 @@ export const webaudioOutput = async (hap, deadline, hapDuration) => { n = 0, note, gain = 0.8, - cutoff, - resonance = 1, - hcutoff, - hresonance = 1, - bandf, - bandq = 1, + // low pass + lpf, + cutoff = lpf, + lpq = 1, + resonance = lpq, + // high pass + hpf, + hcutoff = hpf, + hpq = 1, + hresonance = hpq, + // band pass + bpf, + bandf = bpf, + bpq = 1, + bandq = bpq, + // coarse, crush, shape, diff --git a/website/src/pages/learn/strudel-vs-tidal.mdx b/website/src/pages/learn/strudel-vs-tidal.mdx index 5808fc5f..507286c9 100644 --- a/website/src/pages/learn/strudel-vs-tidal.mdx +++ b/website/src/pages/learn/strudel-vs-tidal.mdx @@ -102,4 +102,4 @@ it aims to provide a standalone live coding environment that runs entirely in th ### Audio Effects Many of SuperDirt's effects have been reimplemented in Strudel, using the Web Audio API. -You can find a (not totally complete) [list of available effects here](./learn/effects). +You can find a [list of available effects here](./learn/effects).