diff options
author | Grant Shangreaux <grant@unabridgedsoftware.com> | 2021-11-07 20:44:12 -0600 |
---|---|---|
committer | Grant Shangreaux <grant@unabridgedsoftware.com> | 2021-11-07 20:44:12 -0600 |
commit | bbaff2f4c5d379276034976503ce026dbd153132 (patch) | |
tree | 79f66b1ff367297ad430490a00fac1113c531f25 /klangfarbrs | |
parent | ef7fcf7a878143627af178a23d75e0301a40d677 (diff) |
Fix: frequency modulation implementation to be correct :|
Diffstat (limited to 'klangfarbrs')
-rw-r--r-- | klangfarbrs/src/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/klangfarbrs/src/lib.rs b/klangfarbrs/src/lib.rs index 07e9cc7..fafb5c0 100644 --- a/klangfarbrs/src/lib.rs +++ b/klangfarbrs/src/lib.rs @@ -157,7 +157,7 @@ impl MonoSynth { release: 0, cutoff: 0.0, frequency_modulation: false, - fm_frequency: 30000.0, + fm_frequency: 10.0, fm_depth: 0.1, fm_phasor: Phasor { phase: 0.0 } } @@ -234,7 +234,7 @@ impl MonoSynth { if self.frequency_modulation { let modulation_value = Osc::generate_sample(&Waveform::Sine, self.fm_phasor.phase) * self.fm_depth; self.fm_phasor.phase = self.fm_phasor.next_phase(self.fm_frequency, self.sample_rate); - next_phase = self.phasor.next_phase(self.frequency * modulation_value, self.sample_rate); + next_phase = self.phasor.next_phase(self.frequency + modulation_value, self.sample_rate); } else { next_phase = self.phasor.next_phase(self.frequency, self.sample_rate); } |