Merge pull request #1107 from daslyfe/fanchor

change fanchor to 0
This commit is contained in:
Felix Roos
2024-05-31 10:25:24 +02:00
committed by GitHub
4 changed files with 118 additions and 20 deletions
+9
View File
@@ -766,6 +766,15 @@ export const { bprelease, bpr } = registerControl('bprelease', 'bpr');
* .ftype("<ladder 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.
+65 -20
View File
@@ -24,6 +24,52 @@ export function getSound(s) {
return soundMap.get()[s];
}
const defaultDefaultValues = {
s: 'triangle',
gain: 0.8,
postgain: 1,
density: '.03',
ftype: '12db',
fanchor: 0,
resonance: 1,
hresonance: 1,
bandq: 1,
channels: [1, 2],
phaserdepth: 0.75,
shapevol: 1,
distortvol: 1,
delay: 0,
delayfeedback: 0.5,
delaytime: 0.25,
orbit: 1,
i: 1,
velocity: 1,
fft: 8,
};
let defaultControls = new Map(Object.entries(defaultDefaultValues));
export function setDefaultValue(key, value) {
defaultControls.set(key, value);
}
export function getDefaultValue(key) {
return defaultControls.get(key);
}
export function setDefaultValues(defaultsobj) {
Object.keys(defaultsobj).forEach((key) => {
setDefaultValue(key, defaultsobj[key]);
});
}
export function resetDefaultValues() {
defaultControls = new Map(Object.entries(defaultDefaultValues));
}
export function setVersionDefaults(version) {
resetDefaultValues();
if (version === '1.0') {
setDefaultValue('fanchor', 0.5);
}
}
export const resetLoadedSounds = () => soundMap.set({});
let audioContext;
@@ -276,15 +322,14 @@ export const superdough = async (value, t, hapDuration) => {
}
// destructure
let {
s = 'triangle',
s = getDefaultValue('s'),
bank,
source,
gain = 0.8,
postgain = 1,
density = 0.03,
gain = getDefaultValue('gain'),
postgain = getDefaultValue('postgain'),
density = getDefaultValue('density'),
// filters
fanchor = 0.5,
fanchor = getDefaultValue('fanchor'),
drive = 0.69,
// low pass
cutoff,
@@ -293,7 +338,7 @@ export const superdough = async (value, t, hapDuration) => {
lpdecay,
lpsustain,
lprelease,
resonance = 1,
resonance = getDefaultValue('resonance'),
// high pass
hpenv,
hcutoff,
@@ -301,7 +346,7 @@ export const superdough = async (value, t, hapDuration) => {
hpdecay,
hpsustain,
hprelease,
hresonance = 1,
hresonance = getDefaultValue('hresonance'),
// band pass
bpenv,
bandf,
@@ -309,36 +354,36 @@ export const superdough = async (value, t, hapDuration) => {
bpdecay,
bpsustain,
bprelease,
bandq = 1,
channels = [1, 2],
bandq = getDefaultValue('bandq'),
channels = getDefaultValue('channels'),
//phaser
phaser,
phaserdepth = 0.75,
phaserdepth = getDefaultValue('phaserdepth'),
phasersweep,
phasercenter,
//
coarse,
crush,
shape,
shapevol = 1,
shapevol = getDefaultValue('shapevol'),
distort,
distortvol = 1,
distortvol = getDefaultValue('distortvol'),
pan,
vowel,
delay = 0,
delayfeedback = 0.5,
delaytime = 0.25,
orbit = 1,
delay = getDefaultValue('delay'),
delayfeedback = getDefaultValue('delayfeedback'),
delaytime = getDefaultValue('delaytime'),
orbit = getDefaultValue('orbit'),
room,
roomfade,
roomlp,
roomdim,
roomsize,
ir,
i = 0,
velocity = 1,
i = getDefaultValue('i'),
velocity = getDefaultValue('velocity'),
analyze, // analyser wet
fft = 8, // fftSize 0 - 10
fft = getDefaultValue('fft'), // fftSize 0 - 10
compressor: compressorThreshold,
compressorRatio,
compressorKnee,