This commit is contained in:
Jade (Rose) Rowland 2025-03-03 21:26:42 -05:00
parent b4af840240
commit 64b99f5a8c
2 changed files with 3 additions and 2 deletions

View File

@ -183,7 +183,7 @@ export function registerSynthSounds() {
end,
);
getParamADSR(envGain.gain, attack, decay, sustain, release, 0, 0.3, begin, holdend, 'linear');
getParamADSR(envGain.gain, attack, decay, sustain, release, 0, 1, begin, holdend, 'linear');
return {
node: envGain,

View File

@ -659,6 +659,7 @@ class PhaseVocoderProcessor extends OLAProcessor {
registerProcessor('phase-vocoder-processor', PhaseVocoderProcessor);
// Adapted from https://www.musicdsp.org/en/latest/Effects/221-band-limited-pwm-generator.html
class PulseOscillatorProcessor extends AudioWorkletProcessor {
constructor() {
super();
@ -720,7 +721,7 @@ class PulseOscillatorProcessor extends AudioWorkletProcessor {
dphi;
for (let i = 0; i < (output[0].length ?? 0); i++) {
const pw = clamp(getParamValue(i, params.pulsewidth), 0.01, 0.99) * _PI * 2;
const pw = (1 - clamp(getParamValue(i, params.pulsewidth), 0, 0.99)) * this.pi;
const detune = getParamValue(i, params.detune);
const freq = applySemitoneDetuneToFrequency(getParamValue(i, params.frequency), detune / 100);