From c748d79963a404cfe0e28c8f6d88dad8e88fc803 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Wed, 5 Apr 2023 19:08:59 +0200 Subject: [PATCH] Temporarily remove slew compensation We should probably just upsample the slews as a control signal and use that instead. --- plugins/aw_soft_vacuum/src/hard_vacuum.rs | 8 +------- plugins/aw_soft_vacuum/src/lib.rs | 9 --------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/plugins/aw_soft_vacuum/src/hard_vacuum.rs b/plugins/aw_soft_vacuum/src/hard_vacuum.rs index b2544cc8..f18f6705 100644 --- a/plugins/aw_soft_vacuum/src/hard_vacuum.rs +++ b/plugins/aw_soft_vacuum/src/hard_vacuum.rs @@ -40,10 +40,6 @@ pub struct Params { pub warmth: f32, /// The 'aura' parameter, should be in the range `[0, pi]`. pub aura: f32, - - /// A factor slews should be multiplied with. Set above 1.0 when oversampling to compensate for - /// the waveform becoming smoother. - pub slew_compensation_factor: f32, } impl HardVacuum { @@ -72,10 +68,8 @@ impl HardVacuum { // AW: We're doing all this here so skew isn't incremented by each stage let skew = { - // NOTE: The `slew_compensation_factor` is an addition to make the algorithm behave more - // consistently when oversampling // AW: skew will be direction/angle - let skew = (input - self.last_sample) * params.slew_compensation_factor; + let skew = input - self.last_sample; // AW: for skew we want it to go to zero effect again, so we use full range of the sine let bridge_rectifier = skew.abs().min(PI).sin(); diff --git a/plugins/aw_soft_vacuum/src/lib.rs b/plugins/aw_soft_vacuum/src/lib.rs index 1d6ad502..b3f3c4ea 100644 --- a/plugins/aw_soft_vacuum/src/lib.rs +++ b/plugins/aw_soft_vacuum/src/lib.rs @@ -292,13 +292,6 @@ impl Plugin for SoftVacuum { context.set_latency_samples(oversampler.latency(oversampling_factor)); } - // The Hard Vacuum algorithm makes use of slews, and the aura control amplifies this part. - // The oversampling rounds out the waveform and reduces those slews. This is a rough - // compensation to get the distortion to sound like it normally would. The alternative would - // be to upsample the slews independently. - // FIXME: Maybe just upsample the slew signal instead, that should be more accurate - let slew_oversampling_compensation_factor = (oversampling_times - 1) as f32 * 0.7; - for (_, block) in buffer.iter_blocks(MAX_BLOCK_SIZE) { let block_len = block.samples(); let upsampled_block_len = block_len * oversampling_times; @@ -349,8 +342,6 @@ impl Plugin for SoftVacuum { drive: unsafe { *drive.get_unchecked(sample_idx) }, warmth: unsafe { *warmth.get_unchecked(sample_idx) }, aura: unsafe { *aura.get_unchecked(sample_idx) }, - - slew_compensation_factor: slew_oversampling_compensation_factor, }; let output_gain = unsafe { *output_gain.get_unchecked(sample_idx) }; let dry_wet_ratio = unsafe { *dry_wet_ratio.get_unchecked(sample_idx) };