gaincurve
This commit is contained in:
parent
3ac0fdf619
commit
aeaed50446
1 changed files with 15 additions and 6 deletions
|
|
@ -1,6 +1,15 @@
|
||||||
// this is dough, the superdough without dependencies
|
// this is dough, the superdough without dependencies
|
||||||
const SAMPLE_RATE = typeof sampleRate !== 'undefined' ? sampleRate : 48000;
|
const SAMPLE_RATE = typeof sampleRate !== 'undefined' ? sampleRate : 48000;
|
||||||
const ISR = 1 / SAMPLE_RATE;
|
const ISR = 1 / SAMPLE_RATE;
|
||||||
|
|
||||||
|
let gainCurveFunc = (val) => Math.pow(val, 2);
|
||||||
|
|
||||||
|
function applyGainCurve(val) {
|
||||||
|
return gainCurveFunc(val);
|
||||||
|
}
|
||||||
|
// function setGainCurve(newGainCurveFunc) {
|
||||||
|
// gainCurveFunc = newGainCurveFunc;
|
||||||
|
// }
|
||||||
// https://garten.salat.dev/audio-DSP/oscillators.html
|
// https://garten.salat.dev/audio-DSP/oscillators.html
|
||||||
export class SineOsc {
|
export class SineOsc {
|
||||||
phase = 0;
|
phase = 0;
|
||||||
|
|
@ -522,15 +531,15 @@ export class DoughVoice {
|
||||||
let $ = this;
|
let $ = this;
|
||||||
Object.assign($, value);
|
Object.assign($, value);
|
||||||
$.s = $.s ?? getDefaultValue('s');
|
$.s = $.s ?? getDefaultValue('s');
|
||||||
$.gain = $.gain ?? getDefaultValue('gain');
|
$.gain = applyGainCurve($.gain ?? getDefaultValue('gain'));
|
||||||
$.velocity = $.velocity ?? getDefaultValue('velocity');
|
$.velocity = applyGainCurve($.velocity ?? getDefaultValue('velocity'));
|
||||||
$.postgain = $.postgain ?? getDefaultValue('postgain');
|
$.postgain = applyGainCurve($.postgain ?? getDefaultValue('postgain'));
|
||||||
$.density = $.density ?? getDefaultValue('density');
|
$.density = $.density ?? getDefaultValue('density');
|
||||||
$.fanchor = $.fanchor ?? getDefaultValue('fanchor');
|
$.fanchor = $.fanchor ?? getDefaultValue('fanchor');
|
||||||
$.drive = $.drive ?? 0.69;
|
$.drive = $.drive ?? 0.69;
|
||||||
$.phaserdepth = $.phaserdepth ?? getDefaultValue('phaserdepth');
|
$.phaserdepth = $.phaserdepth ?? getDefaultValue('phaserdepth');
|
||||||
$.shapevol = $.shapevol ?? getDefaultValue('shapevol');
|
$.shapevol = applyGainCurve($.shapevol ?? getDefaultValue('shapevol'));
|
||||||
$.distortvol = $.distortvol ?? getDefaultValue('distortvol');
|
$.distortvol = applyGainCurve($.distortvol ?? getDefaultValue('distortvol'));
|
||||||
$.i = $.i ?? getDefaultValue('i');
|
$.i = $.i ?? getDefaultValue('i');
|
||||||
$.fft = $.fft ?? getDefaultValue('fft');
|
$.fft = $.fft ?? getDefaultValue('fft');
|
||||||
$.pan = $.pan ?? getDefaultValue('pan');
|
$.pan = $.pan ?? getDefaultValue('pan');
|
||||||
|
|
@ -582,7 +591,7 @@ export class DoughVoice {
|
||||||
// gain envelope
|
// gain envelope
|
||||||
$._adsr = new ADSR({ decayCurve: 2 });
|
$._adsr = new ADSR({ decayCurve: 2 });
|
||||||
// delay
|
// delay
|
||||||
$.delay = $.delay ?? getDefaultValue('delay');
|
$.delay = applyGainCurve($.delay ?? getDefaultValue('delay'));
|
||||||
$.delayfeedback = $.delayfeedback ?? getDefaultValue('delayfeedback');
|
$.delayfeedback = $.delayfeedback ?? getDefaultValue('delayfeedback');
|
||||||
$.delaytime = $.delaytime ?? getDefaultValue('delaytime');
|
$.delaytime = $.delaytime ?? getDefaultValue('delaytime');
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue