1
0
Fork 0

Add compressor params for Spectral Compressor

These are not yet hooked up to anything.
This commit is contained in:
Robbert van der Helm 2022-07-20 20:21:13 +02:00
parent 83d8c7a9f4
commit 07136bcdc9

View file

@ -79,10 +79,10 @@ struct SpectralCompressorParams {
/// then this acts as an offset on top of that. /// then this acts as an offset on top of that.
#[id = "output_db"] #[id = "output_db"]
output_gain_db: FloatParam, output_gain_db: FloatParam,
/// Try to automatically compensate for low thresholds. Doesn't do anything when sidechaining is // TODO: Bring this back, and with values that make more sense
/// active. // /// Try to automatically compensate for gain differences with different input gain, threshold, and ratio values.
#[id = "auto_makeup"] // #[id = "auto_makeup"]
auto_makeup_gain: BoolParam, // auto_makeup_gain: BoolParam,
/// How much of the dry signal to mix in with the processed signal. The mixing is done after /// How much of the dry signal to mix in with the processed signal. The mixing is done after
/// applying the output gain. In other words, the dry signal is not gained in any way. /// applying the output gain. In other words, the dry signal is not gained in any way.
#[id = "dry_wet"] #[id = "dry_wet"]
@ -91,6 +91,32 @@ struct SpectralCompressorParams {
/// plugin and it will thus just eat up headroom. /// plugin and it will thus just eat up headroom.
#[id = "dc_filter"] #[id = "dc_filter"]
dc_filter: BoolParam, dc_filter: BoolParam,
// TODO: Custom target curves for the non-sidechained version
//
// TODO: Sidechaining
//
/// The downwards compression threshold relative to the target curve.
#[id = "thresh_down_off"]
downwards_threshold_offset_db: FloatParam,
#[id = "thresh_up_off"]
/// The upwards compression threshold relative to the target curve.
upwards_threshold_offset_db: FloatParam,
/// The downwards compression ratio. At 1.0 the downwards compressor is disengaged.
#[id = "ratio_down"]
downwards_ratio: FloatParam,
/// The upwards compression ratio. At 1.0 the upwards compressor is disengaged.
#[id = "ratio_up"]
upwards_ratio: FloatParam,
// TODO: High frequency ratio falloff, make the compression milder for higher frequencies to make it less piercing
/// The compressor's attack time in milliseconds. Controls both upwards and downwards
/// compression.
#[id = "attack"]
compressor_attack_ms: FloatParam,
/// The compressor's release time in milliseconds. Controls both upwards and downwards
/// compression.
#[id = "release"]
compressor_release_ms: FloatParam,
} }
impl Default for SpectralCompressor { impl Default for SpectralCompressor {
@ -137,13 +163,83 @@ impl Default for SpectralCompressorParams {
) )
.with_unit(" dB") .with_unit(" dB")
.with_step_size(0.1), .with_step_size(0.1),
auto_makeup_gain: BoolParam::new("Auto Makeup Gain", true), // auto_makeup_gain: BoolParam::new("Auto Makeup Gain", true),
dry_wet_ratio: FloatParam::new("Mix", 1.0, FloatRange::Linear { min: 0.0, max: 1.0 }) dry_wet_ratio: FloatParam::new("Mix", 1.0, FloatRange::Linear { min: 0.0, max: 1.0 })
.with_unit("%") .with_unit("%")
.with_smoother(SmoothingStyle::Linear(15.0)) .with_smoother(SmoothingStyle::Linear(15.0))
.with_value_to_string(formatters::v2s_f32_percentage(0)) .with_value_to_string(formatters::v2s_f32_percentage(0))
.with_string_to_value(formatters::s2v_f32_percentage()), .with_string_to_value(formatters::s2v_f32_percentage()),
dc_filter: BoolParam::new("DC Filter", true), dc_filter: BoolParam::new("DC Filter", true),
// TODO: Set nicer default values for these things
// As explained above, these offsets are relative to the target curve
downwards_threshold_offset_db: FloatParam::new(
"Downwards Threshold Offset",
0.0,
FloatRange::Linear {
min: -50.0,
max: 50.0,
},
)
.with_unit(" dB")
.with_step_size(0.1),
upwards_threshold_offset_db: FloatParam::new(
"Upwards Threshold Offset",
0.0,
FloatRange::Linear {
min: -50.0,
max: 50.0,
},
)
.with_unit(" dB")
.with_step_size(0.1),
downwards_ratio: FloatParam::new(
"Downwards Ratio",
1.0,
FloatRange::Skewed {
min: 1.0,
max: 300.0,
factor: FloatRange::skew_factor(-2.0),
},
)
.with_step_size(0.1)
.with_value_to_string(formatters::v2s_compression_ratio(1))
.with_string_to_value(formatters::s2v_compression_ratio()),
upwards_ratio: FloatParam::new(
"Upwards Ratio",
1.0,
FloatRange::Skewed {
min: 1.0,
max: 300.0,
factor: FloatRange::skew_factor(-2.0),
},
)
.with_step_size(0.1)
.with_value_to_string(formatters::v2s_compression_ratio(1))
.with_string_to_value(formatters::s2v_compression_ratio()),
compressor_attack_ms: FloatParam::new(
"Attack",
150.0,
FloatRange::Skewed {
// TODO: Make sure to handle 0 attack and release times in the compressor
min: 0.0,
max: 10_000.0,
factor: FloatRange::skew_factor(-2.0),
},
)
.with_unit(" ms")
.with_step_size(0.1),
compressor_release_ms: FloatParam::new(
"Release",
300.0,
FloatRange::Skewed {
min: 0.0,
max: 10_000.0,
factor: FloatRange::skew_factor(-2.0),
},
)
.with_unit(" ms")
.with_step_size(0.1),
} }
} }
} }