synthesizer-core-0.5.2: Audio signal processing coded in Haskell: Low level part

Safe HaskellNone

Synthesizer.Generic.Fourier

Contents

Description

Complete implementation for Fast Fourier Transform for any signal length. Although defined for all kinds of signal storage, we need fast access to arbitrary indices.

Synopsis

Documentation

class C y => Element y whereSource

Methods

recipInteger :: Read sig y => sig y -> ySource

addId :: Read sig y => sig y -> ySource

multId :: Read sig y => sig y -> ySource

conjugatePrimitiveRootsOfUnity :: Read sig y => sig y -> (y, y)Source

It must hold:

 uncurry (*) (conjugatePrimitiveRootsOfUnity n) = 1
 mapPair ((^m), (^m)) (conjugatePrimitiveRootsOfUnity (n*m) y)
    == conjugatePrimitiveRootsOfUnity n y@

since we need for caching that the cache is uniquely determined by singal length and transform direction.

Instances

C a => Element (T a) 
(PrimitiveRoot a, C a, Eq a) => Element (T a) 

conversion between time and frequency domain (spectrum)

transformForward :: (Element y, Transform sig y) => sig y -> sig ySource

transformBackward :: (Element y, Transform sig y) => sig y -> sig ySource

Shall we divide the result values by the length of the signal? Our dimensional wrapper around the Fourier transform does not expect this.

cacheForward :: (Element y, Transform sig y) => sig y -> Cache sig ySource

The expression cacheForward prototype precomputes all data that is needed for forward Fourier transforms for signals of the type and length prototype. You can use this cache in transformWithCache.

cacheBackward :: (Element y, Transform sig y) => sig y -> Cache sig ySource

cacheDuplex :: (Element y, Transform sig y) => sig y -> (Cache sig y, Cache sig y)Source

It is (cacheForward x, cacheBackward x) = cacheDuplex x but cacheDuplex shared common data of both caches.

transformWithCache :: (Element y, Transform sig y) => Cache sig y -> sig y -> sig ySource

The size and type of the signal must match the parameters, that the cache was generated for.

convolution based on Fourier transform

convolveCyclic :: (Element y, Transform sig y) => sig y -> sig y -> sig ySource

Signal must have equal size and must not be empty.

data Window sig y Source

Filter window stored as spectrum such that it can be applied efficiently to long signals.

Instances

(Show y, Show (sig y)) => Show (Window sig y) 

window :: (Element y, Transform sig y) => sig y -> Window sig ySource

convolveWithWindow :: (Element y, Transform sig y) => Window sig y -> sig y -> sig ySource

Efficient convolution of a large filter window with a probably infinite signal.