Make every preset as loud as 8-bit: per-preset output makeup gain

The vocoder/ring-mod/bandpass presets were 10-20 dB quieter than 8-bit.
Each preset now carries an output makeup gain normalized from tone
measurements; all presets peak around -1..-6 dB (was -9..-20).
This commit is contained in:
loki5512344 2026-08-02 19:07:49 +02:00
parent 7e8972e716
commit a0967ea74f
3 changed files with 23 additions and 1 deletions

View file

@ -54,6 +54,7 @@ impl FileConfig {
pitch_semitones: c.pitch.unwrap_or(0.0),
formant_ratio: c.formant.unwrap_or(1.0),
effects: c.effects.clone().unwrap_or_default(),
gain: 1.0,
})
.collect()
})

View file

@ -132,6 +132,7 @@ impl Processor {
formant,
gate_db,
gain,
preset_gain,
mute,
record,
mode,
@ -149,6 +150,7 @@ impl Processor {
preset.formant_ratio * ratio_from_semitones(ctrl.formant_delta),
ctrl.gate_threshold_db,
ctrl.gain,
preset.gain,
ctrl.mute,
ctrl.record,
ctrl.mode,
@ -222,7 +224,7 @@ impl Processor {
}
for s in mono.iter_mut() {
*s *= gain;
*s *= preset_gain * gain;
}
}

View file

@ -14,6 +14,8 @@ pub struct Preset {
pub formant_ratio: f32,
/// Effects applied in order after pitch/formant.
pub effects: Vec<EffectSpec>,
/// Output makeup gain so every preset sounds equally loud.
pub gain: f32,
}
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
@ -79,18 +81,21 @@ fn builtin_presets() -> Vec<Preset> {
pitch_semitones: 0.0,
formant_ratio: 1.0,
effects: vec![],
gain: 1.10,
},
Preset {
name: "Girl / Anime".into(),
pitch_semitones: 5.0,
formant_ratio: 1.25,
effects: vec![],
gain: 1.50,
},
Preset {
name: "Boy".into(),
pitch_semitones: 3.0,
formant_ratio: 1.12,
effects: vec![],
gain: 1.00,
},
Preset {
name: "Manly / Deep".into(),
@ -101,6 +106,7 @@ fn builtin_presets() -> Vec<Preset> {
ratio: 3.0,
makeup_db: 2.0,
}],
gain: 1.50,
},
Preset {
name: "Demon".into(),
@ -117,6 +123,7 @@ fn builtin_presets() -> Vec<Preset> {
wet: 0.4,
},
],
gain: 1.00,
},
Preset {
name: "Robot".into(),
@ -135,6 +142,7 @@ fn builtin_presets() -> Vec<Preset> {
target: 0.6,
},
],
gain: 6.00,
},
Preset {
name: "8-bit".into(),
@ -146,6 +154,7 @@ fn builtin_presets() -> Vec<Preset> {
max_gain: 32.0,
target: 0.6,
}],
gain: 1.00,
},
Preset {
name: "Alien".into(),
@ -162,6 +171,7 @@ fn builtin_presets() -> Vec<Preset> {
wet: 0.4,
},
],
gain: 5.50,
},
Preset {
name: "Radio".into(),
@ -180,6 +190,7 @@ fn builtin_presets() -> Vec<Preset> {
makeup_db: 6.0,
},
],
gain: 1.00,
},
Preset {
name: "Megaphone".into(),
@ -201,6 +212,7 @@ fn builtin_presets() -> Vec<Preset> {
makeup_db: 4.0,
},
],
gain: 1.60,
},
Preset {
name: "Ghost".into(),
@ -218,6 +230,7 @@ fn builtin_presets() -> Vec<Preset> {
wet: 0.5,
},
],
gain: 1.00,
},
Preset {
name: "Cyborg".into(),
@ -236,6 +249,7 @@ fn builtin_presets() -> Vec<Preset> {
target: 0.6,
},
],
gain: 1.20,
},
Preset {
name: "Chipmunk".into(),
@ -247,6 +261,7 @@ fn builtin_presets() -> Vec<Preset> {
max_gain: 8.0,
target: 0.5,
}],
gain: 1.00,
},
Preset {
name: "Helium".into(),
@ -257,6 +272,7 @@ fn builtin_presets() -> Vec<Preset> {
rate_hz: 0.6,
wet: 0.3,
}],
gain: 1.20,
},
Preset {
name: "Vader".into(),
@ -267,6 +283,7 @@ fn builtin_presets() -> Vec<Preset> {
damp: 0.3,
wet: 0.35,
}],
gain: 2.80,
},
Preset {
name: "Telephone".into(),
@ -285,6 +302,7 @@ fn builtin_presets() -> Vec<Preset> {
makeup_db: 8.0,
},
],
gain: 1.00,
},
Preset {
name: "Growl".into(),
@ -301,6 +319,7 @@ fn builtin_presets() -> Vec<Preset> {
wet: 0.3,
},
],
gain: 1.00,
},
]
}