shorepine / amy

AMY - A high-performance fixed-point Music synthesizer librarY for microcontrollers
https://shorepine.github.io/amy/
MIT License
223 stars 14 forks source link

`ratio` should be subsumed by `freq` control coefficients. #222

Open dpwe opened 2 months ago

dpwe commented 2 months ago

The ratio argument sets the osc frequency to some factor times a "base frequency". This is used in FM tones, and is based on the parameter of the same name in the classic DX7 algorithms.

In fact, it's just a special case of the ControlCoefficients. ratio=0.5 means that the oscillator frequency is half the note frequency, which in other situations we'd achieve with freq='130.8,1', i.e. frequency tracking the note, but relative to C3, so an octave below (0.5x the frequency).

We really ought to change over to using freq coefficients, since using ratio diminishes the payoff of getting to grips with ControlCoefficients. At the moment I believe the ratio mechanism overrides the normal freq calculation for FM oscs, and we presumably don't currently propagate the base osc note to the algorithm oscs. So we'd need to fix those too.