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,

View File

@ -2493,6 +2493,43 @@ exports[`runs examples > example "every" example index 0 1`] = `
]
`;
exports[`runs examples > example "fanchor" example index 0 1`] = `
[
"[ 0/1 → 1/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 1/8 → 1/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 1/4 → 3/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 3/8 → 1/2 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 1/2 → 5/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 5/8 → 3/4 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 3/4 → 7/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 7/8 → 1/1 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 1/1 → 9/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 9/8 → 5/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 5/4 → 11/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 11/8 → 3/2 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 3/2 → 13/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 13/8 → 7/4 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 7/4 → 15/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 15/8 → 2/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0.5 ]",
"[ 2/1 → 17/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 17/8 → 9/4 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 9/4 → 19/8 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 19/8 → 5/2 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 5/2 → 21/8 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 21/8 → 11/4 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 11/4 → 23/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 23/8 → 3/1 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:1 ]",
"[ 3/1 → 25/8 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 25/8 → 13/4 | note:d s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 13/4 → 27/8 | note:a s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 27/8 → 7/2 | note:a# s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 7/2 → 29/8 | note:f s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 29/8 → 15/4 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 15/4 → 31/8 | note:g s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
"[ 31/8 → 4/1 | note:c s:sawtooth cutoff:1000 lpenv:8 fanchor:0 ]",
]
`;
exports[`runs examples > example "fast" example index 0 1`] = `
[
"[ 0/1 → 1/8 | s:bd ]",
@ -5035,72 +5072,6 @@ exports[`runs examples > example "ply" example index 0 1`] = `
]
`;
exports[`runs examples > example "polymeter" example index 0 1`] = `
[
"[ 0/1 → 1/3 | c ]",
"[ 0/1 → 1/3 | c2 ]",
"[ 1/3 → 2/3 | eb ]",
"[ 1/3 → 2/3 | g2 ]",
"[ 2/3 → 1/1 | g ]",
"[ 2/3 → 1/1 | c2 ]",
"[ 1/1 → 4/3 | c ]",
"[ 1/1 → 4/3 | g2 ]",
"[ 4/3 → 5/3 | eb ]",
"[ 4/3 → 5/3 | c2 ]",
"[ 5/3 → 2/1 | g ]",
"[ 5/3 → 2/1 | g2 ]",
"[ 2/1 → 7/3 | c ]",
"[ 2/1 → 7/3 | c2 ]",
"[ 7/3 → 8/3 | eb ]",
"[ 7/3 → 8/3 | g2 ]",
"[ 8/3 → 3/1 | g ]",
"[ 8/3 → 3/1 | c2 ]",
"[ 3/1 → 10/3 | c ]",
"[ 3/1 → 10/3 | g2 ]",
"[ 10/3 → 11/3 | eb ]",
"[ 10/3 → 11/3 | c2 ]",
"[ 11/3 → 4/1 | g ]",
"[ 11/3 → 4/1 | g2 ]",
]
`;
exports[`runs examples > example "polymeterSteps" example index 0 1`] = `
[
"[ 0/1 → 1/4 | c ]",
"[ 0/1 → 1/4 | e ]",
"[ 1/4 → 1/2 | d ]",
"[ 1/4 → 1/2 | f ]",
"[ 1/2 → 3/4 | c ]",
"[ 1/2 → 3/4 | g ]",
"[ 3/4 → 1/1 | d ]",
"[ 3/4 → 1/1 | e ]",
"[ 1/1 → 5/4 | c ]",
"[ 1/1 → 5/4 | f ]",
"[ 5/4 → 3/2 | d ]",
"[ 5/4 → 3/2 | g ]",
"[ 3/2 → 7/4 | c ]",
"[ 3/2 → 7/4 | e ]",
"[ 7/4 → 2/1 | d ]",
"[ 7/4 → 2/1 | f ]",
"[ 2/1 → 9/4 | c ]",
"[ 2/1 → 9/4 | g ]",
"[ 9/4 → 5/2 | d ]",
"[ 9/4 → 5/2 | e ]",
"[ 5/2 → 11/4 | c ]",
"[ 5/2 → 11/4 | f ]",
"[ 11/4 → 3/1 | d ]",
"[ 11/4 → 3/1 | g ]",
"[ 3/1 → 13/4 | c ]",
"[ 3/1 → 13/4 | e ]",
"[ 13/4 → 7/2 | d ]",
"[ 13/4 → 7/2 | f ]",
"[ 7/2 → 15/4 | c ]",
"[ 7/2 → 15/4 | g ]",
"[ 15/4 → 4/1 | d ]",
"[ 15/4 → 4/1 | e ]",
]
`;
exports[`runs examples > example "postgain" example index 0 1`] = `
[
"[ 0/1 → 1/8 | s:hh compressor:-20 compressorRatio:20 compressorKnee:10 compressorAttack:0.002 compressorRelease:0.02 postgain:1.5 ]",
@ -7216,31 +7187,6 @@ exports[`runs examples > example "stack" example index 0 2`] = `
]
`;
exports[`runs examples > example "stepcat" example index 0 1`] = `
[
"[ 0/1 → 1/5 | s:bd ]",
"[ 1/5 → 2/5 | s:cp ]",
"[ 2/5 → 3/5 | s:bd ]",
"[ 3/5 → 4/5 | s:mt ]",
"[ 4/5 → 1/1 | s:bd ]",
"[ 1/1 → 6/5 | s:bd ]",
"[ 6/5 → 7/5 | s:cp ]",
"[ 7/5 → 8/5 | s:bd ]",
"[ 8/5 → 9/5 | s:mt ]",
"[ 9/5 → 2/1 | s:bd ]",
"[ 2/1 → 11/5 | s:bd ]",
"[ 11/5 → 12/5 | s:cp ]",
"[ 12/5 → 13/5 | s:bd ]",
"[ 13/5 → 14/5 | s:mt ]",
"[ 14/5 → 3/1 | s:bd ]",
"[ 3/1 → 16/5 | s:bd ]",
"[ 16/5 → 17/5 | s:cp ]",
"[ 17/5 → 18/5 | s:bd ]",
"[ 18/5 → 19/5 | s:mt ]",
"[ 19/5 → 4/1 | s:bd ]",
]
`;
exports[`runs examples > example "steps" example index 0 1`] = `
[
"[ 0/1 → 1/4 | s:bd ]",
@ -7554,65 +7500,6 @@ exports[`runs examples > example "swingBy" example index 0 1`] = `
]
`;
exports[`runs examples > example "timecat" example index 0 1`] = `
[
"[ 0/1 → 3/4 | note:e3 ]",
"[ 3/4 → 1/1 | note:g3 ]",
"[ 1/1 → 7/4 | note:e3 ]",
"[ 7/4 → 2/1 | note:g3 ]",
"[ 2/1 → 11/4 | note:e3 ]",
"[ 11/4 → 3/1 | note:g3 ]",
"[ 3/1 → 15/4 | note:e3 ]",
"[ 15/4 → 4/1 | note:g3 ]",
]
`;
exports[`runs examples > example "timecat" example index 1 1`] = `
[
"[ 0/1 → 1/5 | s:bd ]",
"[ 1/5 → 2/5 | s:sd ]",
"[ 2/5 → 3/5 | s:cp ]",
"[ 3/5 → 4/5 | s:hh ]",
"[ 4/5 → 1/1 | s:hh ]",
"[ 1/1 → 6/5 | s:bd ]",
"[ 6/5 → 7/5 | s:sd ]",
"[ 7/5 → 8/5 | s:cp ]",
"[ 8/5 → 9/5 | s:hh ]",
"[ 9/5 → 2/1 | s:hh ]",
"[ 2/1 → 11/5 | s:bd ]",
"[ 11/5 → 12/5 | s:sd ]",
"[ 12/5 → 13/5 | s:cp ]",
"[ 13/5 → 14/5 | s:hh ]",
"[ 14/5 → 3/1 | s:hh ]",
"[ 3/1 → 16/5 | s:bd ]",
"[ 16/5 → 17/5 | s:sd ]",
"[ 17/5 → 18/5 | s:cp ]",
"[ 18/5 → 19/5 | s:hh ]",
"[ 19/5 → 4/1 | s:hh ]",
]
`;
exports[`runs examples > example "toTactus" example index 0 1`] = `
[
"[ 0/1 → 1/4 | s:bd ]",
"[ 1/4 → 1/2 | s:sd ]",
"[ 1/2 → 3/4 | s:cp ]",
"[ 3/4 → 1/1 | s:bd ]",
"[ 1/1 → 5/4 | s:sd ]",
"[ 5/4 → 3/2 | s:cp ]",
"[ 3/2 → 7/4 | s:bd ]",
"[ 7/4 → 2/1 | s:sd ]",
"[ 2/1 → 9/4 | s:cp ]",
"[ 9/4 → 5/2 | s:bd ]",
"[ 5/2 → 11/4 | s:sd ]",
"[ 11/4 → 3/1 | s:cp ]",
"[ 3/1 → 13/4 | s:bd ]",
"[ 13/4 → 7/2 | s:sd ]",
"[ 7/2 → 15/4 | s:cp ]",
"[ 15/4 → 4/1 | s:bd ]",
]
`;
exports[`runs examples > example "transpose" example index 0 1`] = `
[
"[ 0/1 → 1/4 | note:C2 ]",