synthesizer-llvm-0.7.0.1: Efficient signal processing using runtime compilation

Safe HaskellNone
LanguageHaskell98

Synthesizer.LLVM.Wave

Synopsis

Documentation

triangleSquarePower :: (PseudoRing a, RationalConstant a, Real a) => Integer -> a -> CodeGenFunction r a Source

Discrete interpolation between triangle and square wave. For exponent 1 we get a triangle wave. The larger the exponent, the more we approach a square wave, the.more computing is necessary.

triangleSquareRatio :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r a Source

Continuous interpolation between triangle and square wave. For factor 0 we get a square wave, for factor 1 we get a triangle wave.

rationalApproxCosine1 :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r a Source

For the distortion factor recip pi you get the closest approximation to an undistorted cosine or sine. We have chosen this scaling in order to stay with field operations.

rationalApproxSine1 :: (Field a, RationalConstant a, Real a) => a -> a -> CodeGenFunction r a Source

For the distortion factor recip pi you get the closest approximation to an undistorted cosine or sine. We have chosen this scaling in order to stay with field operations.

replicate :: (PseudoRing a, RationalConstant a, Fraction a) => a -> a -> CodeGenFunction r a Source

This can be used for preprocessing the phase in order to generate locally faster oscillating waves. For example

triangle <=< replicate (valueOf 2.5)

shrinks a triangle wave such that 2.5 periods fit into one.

halfEnvelope :: (PseudoRing a, RationalConstant a, Fraction a) => a -> CodeGenFunction r a Source

Preprocess the phase such that the first half of a wave is expanded to one period and shifted by 90 degree. E.g.

sine <=< halfEnvelope

generates a sequence of sine bows that starts and ends with the maximum. Such a signal can be used to envelope an oscillation generated using replicate.