You are right that the conventional dsp-like phase battery approach is not well suited for parallel computing on a GPU; therefore, the βpure mathematicalβ method is probably the best option.
A generalization of the simple FM Chowning formula to more general frequency modulation functions is provided on the Wikipedia page for frequency modulation (the very first equation on this page). The key point is that the argument to the cos function is the phase, which, as the equation in Wikipedia shows, is an integral over time of the frequency. In FM, the frequency is usually the carrier plus modulation: for example, with the Chowning formula for simple sinusoidal FM, the frequency as a function of time t is
f(t) = f_c - M * f_m * sin(f_m * t)
where f_c is the carrier frequency, M is the amount of modulation, and f_m is the modulation frequency. It integrates with phase
p(t) = f_c * t + M * cos(f_m * t)
which corresponds to the phase in the equation in your question.
To modulate the cosine with a sawtooth saw, f(t) will be a sawtooth wave (plus the carrier frequency), and therefore, to find p(t) , you will need to find the time integral of the sawtooth wave. It's relatively simple (it should be a piecewise-quadratic function), but the people from math.stackexchange should be able to help if you have difficulties.
(Note. I have formulated everything here in terms of time t , but it could also just be a space x .)
source share