From 26fcf5741b26938298e708e1b5e88c6d0da15545 Mon Sep 17 00:00:00 2001 From: Ivan Bushchik Date: Fri, 19 Jan 2024 09:59:52 +0300 Subject: [PATCH] FM: fix "clicks" Signed-off-by: Ivan Bushchik --- rinth-synth/src/fm.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/rinth-synth/src/fm.rs b/rinth-synth/src/fm.rs index 4bb9545..150299d 100644 --- a/rinth-synth/src/fm.rs +++ b/rinth-synth/src/fm.rs @@ -16,7 +16,7 @@ pub struct ModulationFreq(f32); #[derive(Copy, Clone)] pub struct FrequencyDeviation(f32); -const FIGHT_CLICKS: usize = 128; +const FIGHT_CLICKS: usize = 256; impl Synth for FM { fn from_channel(channel: Channel, bpm: u16) -> Self @@ -84,9 +84,8 @@ impl Synth for FM { // This makes a little linear fade-in-out so we don't get "clicks" * if k <= FIGHT_CLICKS { k as f32 / FIGHT_CLICKS as f32 - } else if k - >= samples - - FIGHT_CLICKS + } else if samples - k + <= FIGHT_CLICKS { (samples - k) as f32 / FIGHT_CLICKS as f32