0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 11:33:54 +01:00

correct the fm mod

This commit is contained in:
2025-03-10 21:44:42 +01:00
parent 67fe502183
commit b3303abded
3 changed files with 3 additions and 24 deletions

View File

@@ -11,6 +11,6 @@ float modulate_fm(FMModulator *fm, float sample) {
float inst_freq = fm->frequency+(sample*fm->deviation);
if (inst_freq < 0.0f) inst_freq = 0.0f;
float out = sinf(fm->osc_phase);
fm->osc_phase += fmodf(fm->osc_phase + ((M_2PI * inst_freq) / fm->sample_rate), M_2PI);
fm->osc_phase = fmodf(fm->osc_phase + ((M_2PI * inst_freq) / fm->sample_rate), M_2PI);
return out;
}