1
0
Fork 0

Temporarily remove slew compensation

We should probably just upsample the slews as a control signal and use
that instead.
This commit is contained in:
Robbert van der Helm 2023-04-05 19:08:59 +02:00
parent 4e0a0d4cd5
commit c748d79963
2 changed files with 1 additions and 16 deletions

View file

@ -40,10 +40,6 @@ pub struct Params {
pub warmth: f32, pub warmth: f32,
/// The 'aura' parameter, should be in the range `[0, pi]`. /// The 'aura' parameter, should be in the range `[0, pi]`.
pub aura: f32, 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 { impl HardVacuum {
@ -72,10 +68,8 @@ impl HardVacuum {
// AW: We're doing all this here so skew isn't incremented by each stage // AW: We're doing all this here so skew isn't incremented by each stage
let skew = { 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 // 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 // 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(); let bridge_rectifier = skew.abs().min(PI).sin();

View file

@ -292,13 +292,6 @@ impl Plugin for SoftVacuum {
context.set_latency_samples(oversampler.latency(oversampling_factor)); 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) { for (_, block) in buffer.iter_blocks(MAX_BLOCK_SIZE) {
let block_len = block.samples(); let block_len = block.samples();
let upsampled_block_len = block_len * oversampling_times; let upsampled_block_len = block_len * oversampling_times;
@ -349,8 +342,6 @@ impl Plugin for SoftVacuum {
drive: unsafe { *drive.get_unchecked(sample_idx) }, drive: unsafe { *drive.get_unchecked(sample_idx) },
warmth: unsafe { *warmth.get_unchecked(sample_idx) }, warmth: unsafe { *warmth.get_unchecked(sample_idx) },
aura: unsafe { *aura.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 output_gain = unsafe { *output_gain.get_unchecked(sample_idx) };
let dry_wet_ratio = unsafe { *dry_wet_ratio.get_unchecked(sample_idx) }; let dry_wet_ratio = unsafe { *dry_wet_ratio.get_unchecked(sample_idx) };