Lengthen struck piano instrument held-note fade tails
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
// Maintainer-controlled web client version.
|
// Maintainer-controlled web client version.
|
||||||
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
|
||||||
window.CHGRID_WEB_VERSION = "2026.02.23 R214";
|
window.CHGRID_WEB_VERSION = "2026.02.23 R215";
|
||||||
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
|
||||||
window.CHGRID_TIME_ZONE = "America/Detroit";
|
window.CHGRID_TIME_ZONE = "America/Detroit";
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ type InstrumentPreset = {
|
|||||||
gain: number;
|
gain: number;
|
||||||
sustainRatio?: number;
|
sustainRatio?: number;
|
||||||
holdSustain?: boolean;
|
holdSustain?: boolean;
|
||||||
|
heldDecayScale?: number;
|
||||||
releaseScale?: number;
|
releaseScale?: number;
|
||||||
vibrato?: { rateHz: number; depthCents: number };
|
vibrato?: { rateHz: number; depthCents: number };
|
||||||
};
|
};
|
||||||
@@ -55,6 +56,7 @@ const PRESETS: Record<Exclude<PianoInstrumentId, 'drum_kit'>, InstrumentPreset>
|
|||||||
gain: 0.32,
|
gain: 0.32,
|
||||||
sustainRatio: 0.5,
|
sustainRatio: 0.5,
|
||||||
holdSustain: false,
|
holdSustain: false,
|
||||||
|
heldDecayScale: 2.0,
|
||||||
releaseScale: 0.9,
|
releaseScale: 0.9,
|
||||||
},
|
},
|
||||||
electric_piano: {
|
electric_piano: {
|
||||||
@@ -66,6 +68,7 @@ const PRESETS: Record<Exclude<PianoInstrumentId, 'drum_kit'>, InstrumentPreset>
|
|||||||
gain: 0.3,
|
gain: 0.3,
|
||||||
sustainRatio: 0.52,
|
sustainRatio: 0.52,
|
||||||
holdSustain: false,
|
holdSustain: false,
|
||||||
|
heldDecayScale: 2.0,
|
||||||
releaseScale: 0.8,
|
releaseScale: 0.8,
|
||||||
},
|
},
|
||||||
guitar: {
|
guitar: {
|
||||||
@@ -77,6 +80,7 @@ const PRESETS: Record<Exclude<PianoInstrumentId, 'drum_kit'>, InstrumentPreset>
|
|||||||
gain: 0.24,
|
gain: 0.24,
|
||||||
sustainRatio: 0.48,
|
sustainRatio: 0.48,
|
||||||
holdSustain: false,
|
holdSustain: false,
|
||||||
|
heldDecayScale: 2.0,
|
||||||
releaseScale: 0.7,
|
releaseScale: 0.7,
|
||||||
},
|
},
|
||||||
organ: {
|
organ: {
|
||||||
@@ -308,7 +312,8 @@ export class PianoSynth {
|
|||||||
voiceGain.gain.exponentialRampToValueAtTime(sustainGain, now + attackSeconds + decaySeconds * 0.6);
|
voiceGain.gain.exponentialRampToValueAtTime(sustainGain, now + attackSeconds + decaySeconds * 0.6);
|
||||||
} else {
|
} else {
|
||||||
// Struck/plucked timbres naturally decay even if the key remains held.
|
// Struck/plucked timbres naturally decay even if the key remains held.
|
||||||
voiceGain.gain.exponentialRampToValueAtTime(0.0001, now + attackSeconds + decaySeconds);
|
const heldDecaySeconds = Math.max(0.25, decaySeconds * (preset.heldDecayScale ?? 2.0));
|
||||||
|
voiceGain.gain.exponentialRampToValueAtTime(0.0001, now + attackSeconds + heldDecaySeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
let tailNode: AudioNode = voiceGain;
|
let tailNode: AudioNode = voiceGain;
|
||||||
|
|||||||
Reference in New Issue
Block a user