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

Safe HaskellNone
LanguageHaskell2010

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 where Source #

Methods

recipInteger :: Read sig y => sig y -> y Source #

addId :: Read sig y => sig y -> y Source #

multId :: Read sig y => sig y -> y Source #

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

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

Methods

recipInteger :: Read sig (T a) => sig (T a) -> T a Source #

addId :: Read sig (T a) => sig (T a) -> T a Source #

multId :: Read sig (T a) => sig (T a) -> T a Source #

conjugatePrimitiveRootsOfUnity :: Read sig (T a) => sig (T a) -> (T a, T a) Source #

C a => Element (T a) Source # 

Methods

recipInteger :: Read sig (T a) => sig (T a) -> T a Source #

addId :: Read sig (T a) => sig (T a) -> T a Source #

multId :: Read sig (T a) => sig (T a) -> T a Source #

conjugatePrimitiveRootsOfUnity :: Read sig (T a) => sig (T a) -> (T a, T a) Source #

conversion between time and frequency domain (spectrum)

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

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

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 y Source #

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 y Source #

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 y Source #

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 y Source #

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 (sig y), Show y) => Show (Window sig y) Source # 

Methods

showsPrec :: Int -> Window sig y -> ShowS #

show :: Window sig y -> String #

showList :: [Window sig y] -> ShowS #

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

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

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