add defaults and fanchor docs

This commit is contained in:
Jade (Rose) Rowland 2024-05-19 21:13:46 -04:00
parent b8085e9dc3
commit eed4a83b71
3 changed files with 53 additions and 151 deletions

View file

@ -753,6 +753,15 @@ export const { bprelease, bpr } = registerControl('bprelease', 'bpr');
* .ftype("12db 24db")
*/
export const { ftype } = registerControl('ftype');
/**
* controls the center of the filter envelope. 0 is unipolar positive, .5 is bipolar, 1 is unipolar negative
* @name fanchor
* @param {number | Pattern} center 0 to 1
* @example
* note("{f g g c d a a#}%8").s("sawtooth").lpf("{1000}%2")
* .lpenv(8).fanchor("<0 .5 1>")
*/
export const { fanchor } = registerControl('fanchor');
/**
* Applies the cutoff frequency of the **h**igh-**p**ass **f**ilter.

View file

@ -24,6 +24,12 @@ export function getSound(s) {
return soundMap.get()[s];
}
const defaults = new Map([['fanchor', 0]]);
export function setDefault(key, value) {
defaults.set(key, value);
}
export const resetLoadedSounds = () => soundMap.set({});
let audioContext;
@ -289,7 +295,7 @@ export const superdough = async (value, t, hapDuration) => {
density = 0.03,
// filters
ftype = '12db',
fanchor = 0,
fanchor = defaults.get('fanchor'),
// low pass
cutoff,
lpenv,