mirror of
https://github.com/eliasstepanik/strudel-docker.git
synced 2026-01-27 05:28:41 +00:00
gain adjustment
This commit is contained in:
parent
8db8307c9e
commit
3410c332d5
@ -76,6 +76,7 @@ export function registerSynthSounds() {
|
|||||||
|
|
||||||
const holdend = begin + duration;
|
const holdend = begin + duration;
|
||||||
const end = holdend + release + 0.01;
|
const end = holdend + release + 0.01;
|
||||||
|
const voices = clamp(unison, 1, 100);
|
||||||
|
|
||||||
let node = getWorklet(
|
let node = getWorklet(
|
||||||
ac,
|
ac,
|
||||||
@ -85,13 +86,14 @@ export function registerSynthSounds() {
|
|||||||
begin,
|
begin,
|
||||||
end,
|
end,
|
||||||
freqspread: detune * 0.1,
|
freqspread: detune * 0.1,
|
||||||
voices: clamp(unison, 0, 100),
|
voices,
|
||||||
panspread: clamp(spread, 0, 1),
|
panspread: clamp(spread, 0, 1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
outputChannelCount: [2],
|
outputChannelCount: [2],
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
const gainAdjustment = 1 / Math.sqrt(voices);
|
||||||
// console.log(node.parameters.get('frequency'));
|
// console.log(node.parameters.get('frequency'));
|
||||||
getPitchEnvelope(node.parameters.get('detune'), value, begin, holdend);
|
getPitchEnvelope(node.parameters.get('detune'), value, begin, holdend);
|
||||||
getVibratoOscillator(node.parameters.get('detune'), value, begin);
|
getVibratoOscillator(node.parameters.get('detune'), value, begin);
|
||||||
@ -99,7 +101,7 @@ export function registerSynthSounds() {
|
|||||||
const envGain = gainNode(1);
|
const envGain = gainNode(1);
|
||||||
node = node.connect(envGain);
|
node = node.connect(envGain);
|
||||||
|
|
||||||
getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3, begin, holdend, 'linear');
|
getParamADSR(node.gain, attack, decay, sustain, release, 0, 0.3 * gainAdjustment, begin, holdend, 'linear');
|
||||||
|
|
||||||
return {
|
return {
|
||||||
node,
|
node,
|
||||||
|
|||||||
@ -230,7 +230,6 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
const freqspread = params.freqspread[0];
|
const freqspread = params.freqspread[0];
|
||||||
let panspread = params.panspread[0];
|
let panspread = params.panspread[0];
|
||||||
panspread = panspread * 0.5 + 0.5;
|
panspread = panspread * 0.5 + 0.5;
|
||||||
const gainAdjustment = 1;
|
|
||||||
|
|
||||||
for (let n = 0; n < voices; n++) {
|
for (let n = 0; n < voices; n++) {
|
||||||
let adj = 0;
|
let adj = 0;
|
||||||
@ -247,8 +246,8 @@ class SuperSawOscillatorProcessor extends AudioWorkletProcessor {
|
|||||||
this.phase[n] = this.phase[n] ?? Math.random();
|
this.phase[n] = this.phase[n] ?? Math.random();
|
||||||
const v = saw(this.phase[n], dt);
|
const v = saw(this.phase[n], dt);
|
||||||
|
|
||||||
output[0][i] = (output[0][i] + v * (1 - balance)) * gainAdjustment;
|
output[0][i] = output[0][i] + v * (1 - balance);
|
||||||
output[1][i] = (output[1][i] + v * balance) * gainAdjustment;
|
output[1][i] = output[1][i] + v * balance;
|
||||||
|
|
||||||
this.phase[n] += dt;
|
this.phase[n] += dt;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user