synthesizer-core-0.7.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

Methods

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

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

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

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

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 y

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

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

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

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

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

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

Signal must have equal size and must not be empty.

data Window sig y

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 y

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

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