[Haskell-cafe] Phase correction?

Henning Thielemann lemming at henning-thielemann.de
Wed Jun 8 19:35:25 UTC 2022


On Wed, 8 Jun 2022, Mario Lang wrote:

> -- The naive question of an experimenting non-math coder person is:
> -- Can a version of `at` be written which compensates for the phase
> -- differences which runs in O(n) where n is the number of curve points?
> -- Intuitively this should be possible given `d` (denominator).
> at' :: Curve a -> Ratio b -> a
> at' c t = undefined

Information that is lost, is lost. You could add the cosine as imaginary 
part to the sine, in order to form a complex number that stores the phase 
in its argument (Complex.phase). But I would not do that. It only works 
for a plain sine wave. For other waveforms like saw tooth, square, etc. 
you need to maintain the phase (which is the integral of the modulation 
curve). That's the safe way to go.


More information about the Haskell-Cafe mailing list